初始化主节点
设置环境变量
MASTER_ADDRESS=192.168.18.131 KUBE_VERSION=1.7.2 KUBE_TOKEN=863f67.19babbff7bfe8543
FLANNEL_VERSION=v0.8.0
初始化
kubeadm init --apiserver-advertise-address=${MASTER_ADDRESS} --token=${KUBE_TOKEN} --ignore-preflight-errors 'Swap' --pod-network-cidr=10.244.0.0/16 —kubernetes-version=v${KUBE_VERSION}
或
kubeadm init --apiserver-advertise-address=${MASTER_ADDRESS}
复制用户配置
mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config
配置网络
kubectl --namespace kube-system apply -f https://raw.githubusercontent.com/coreos/flannel/${FLANNEL_VERSION}/Documentation/kube-flannel-rbac.yml
kubectl --namespace kube-system apply -f https://raw.githubusercontent.com/coreos/flannel/${FLANNEL_VERSION}/Documentation/kube-flannel.yml