1.安装
#apt install docker.io
#apt install -y apt-transport-https ca-certificates curl software-properties-common
#curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | apt-key add -
#curl https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | apt-key add -
#cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main
EOF
#apt update
#apt install kubelet kubeadm kubectl
2.部署
systemd enable docker
kubeadm init --apiserver-advertise-address 192.168.50.105 --pod-network-cidr=10.244.0.0/16
error1:
[ERROR Swap]: running with swap on is not supported. Please disable swap
swapoff -a
error2:
[ERROR Port-10251]: Port 10251 is in use
kubeadm reset
3.配置kubectl
不推荐root用户继续
HOME/.kube
HOME/.kube/config
(id -u):HOME/.kube/config
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
5.添加k8s-node1和k8s-node2
$kubeadm token list