1、将master的admin.conf 文件拷贝到 node节点

[root@k8s-m ~]#scp /etc/kubernetes/admin.conf root@192.168.3.11:/etc/kubernetes/

2、配置环境变量

echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile
source ~/.bash_profile

3、测试

[root@node01 ~]$kubectl get nodes
NAME     STATUS   ROLES                  AGE   VERSION
k8s-m    Ready     master                10d   v1.22.5
node01   Ready    <none>                 10d   v1.22.5
node02   Ready    <none>                 10d   v1.22.5

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐