朱争光

一点点攒起我的那片天

  • 主页
  • 文章分类
  • 标签
  • 我

朱争光

一点点攒起我的那片天

  • 主页
  • 文章分类
  • 标签
  • 我

k8s安装

2017-11-18

设置代理

代理安装
在当前shell启用代理

1
2
3
4
5
6
7
export PROXY_PORT=8118
export PROXY_IP=192.168.15.11
export http_proxy=http://$PROXY_IP:$PROXY_PORT
export HTTP_PROXY=$http_proxy
export https_proxy=$http_proxy
export HTTPS_PROXY=$http_proxy
export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com,example.com,192.168.1.11,192.168.1.12,192.168.1.13"

安装docker

1
2
3
4
5
6
7
8
9
10
11
12
systemctl disable iptables-services firewalld
systemctl stop iptables-services firewalld

cat <<EOF > /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system


curl https://get.docker.com/|sh
systemctl enable docker && systemctl start docker

安装 kubeadm,kubelet,kubectl

1
2
3
4
5
6
7
8
9
10
11
12
13
14
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF
setenforce 0
yum install -y kubelet kubeadm kubectl
source <(kubectl completion bash)
echo "source <(kubectl completion bash)" >> ~/.bashrc
#journalctl -xeu kubelet

运行 k8s

  1. Initializes cluster master node:
    1
    kubeadm init --pod-network-cidr=192.168.0.0/16

如果kubelet启动不起来,查看下日志journalctl -xeu kubelet
*. not work with enabled swap
添加下面的配置

1
echo 'Environment="KUBELET_EXTRA_ARGS=--fail-swap-on=false"' > /etc/systemd/system/kubelet.service.d/90-local-extras.conf

2.Initialize cluster networking:

1
kubectl apply -f https://docs.projectcalico.org/v2.6/getting-started/kubernetes/installation/hosted/kubeadm/1.6/calico.yaml

3.(Optional) Initialize kube-dashboard:

1
curl -L -s https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml  | kubectl apply -f -

访问: https://127.0.0.1:8443
访问不了,:https://github.com/kubernetes/dashboard/wiki/Access-control
目前(v1.7.1)不支持手动切换语言:可以通过浏览器插件更改https://github.com/kubernetes/dashboard/issues/2240
4.如果是单节点需要允许主节点可部署

1
2


安装监控 heapster

1
2
3
kubectl create -f  https://raw.githubusercontent.com/kubernetes/heapster/master/deploy/kube-config/influxdb/influxdb.yaml
kubectl create -f https://raw.githubusercontent.com/kubernetes/heapster/master/deploy/kube-config/influxdb/heapster.yaml
kubectl create -f https://raw.githubusercontent.com/kubernetes/heapster/master/deploy/kube-config/influxdb/grafana.yaml
centos_http代理(ubuntu类似)
前端开发环境构建-sublime
豫ICP备17013970号-1 | Copyright © daozzg.com 保留所有权利。2019 朱争光