[apiclient] All control plane components are healthy after 22.003243 seconds
[token] Using token: 33729e.977f7b5d0a9b5f3e
[apiconfig] Created RBAC rules
[addons] Applied essential addon: kube-proxy
[addons] Applied essential addon: kube-dns
Your Kubernetes master has initialized successfully!
To start using your cluster, you need to run (as a regular user):
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
You can now join any number of machines by running the following on each node
as root:
kubeadm join --token xxxxxxx 192.168.80.28:6443
7.创建kube的目录,添加kubectl配置(master节点)
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
8.用 kubectl 添加网络组件Calico(master节点)
kubectl apply -f
注意:此处坑为该文件未必下载的到,建议还是提前下载到本地,然后执行 kubectl apply -f <本地路径>
9.确认安装是否成功(master节点)
9.1 打开你的/var/log/messages,查看是否有报错,理论上,执行完上一步过去5分钟,日志应该不会有任何错误出现,如果持续报错,并且过了10分钟错误依然没有消失,检查之前的步骤是否有问题
9.2 运行 kubectl get pods --all-namespaces 查看结果,如果STATUS都为Running,恭喜你,你的master已经安装成功了。
注意:你的结果显示的条数未必和我完全一样,因为我这里有node节点的相关信息,而你还没有添加node节点。
[root@centos7-base-ok]# kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
default nginx-app-1666850838-4z2tb 1/1 Running 0 3d
kube-system calico-etcd-0ssdd 1/1 Running 0 3d
kube-system calico-node-1zfxd 2/2 Running 1 3d
kube-system calico-node-s2gfs 2/2 Running 1 3d
kube-system calico-node-xx30v 2/2 Running 1 3d
kube-system calico-policy-controller-336633499-wgl8j 1/1 Running 0 3d
kube-system etcd-k8s-1 1/1 Running 0 3d
kube-system kube-apiserver-k8s-1 1/1 Running 0 3d
kube-system kube-controller-manager-k8s-1 1/1 Running 0 3d
kube-system kube-dns-2425271678-trmxx 3/3 Running 1 3d
kube-system kube-proxy-79kkh 1/1 Running 0 3d
kube-system kube-proxy-n1g6j 1/1 Running 0 3d
kube-system kube-proxy-vccr6 1/1 Running 0 3d
kube-system kube-scheduler-k8s-1 1/1 Running 0 3d
10.安装node节点,执行在master节点执行成功输出的日志语句(node节点执行)