1.在子节点上敲发现没有命令。是因为没有 admin.conf
[root@m2 ~]# kubectl get pod -A error: no configuration has been provided, try setting KUBERNETES_MASTER environment variable
2.在主节点上复制一份admin.conf
[root@m1 kubernetes]# pwd /etc/kubernetes [root@m1 kubernetes]# ls admin.conf controller-manager.conf kubelet.conf manifests pki scheduler.conf
3.添加下面就可以了
[root@m2 kubernetes]# vim /etc/profile export KUBECONFIG=/etc/kubernetes/admin.conf
4.最后:source /etc/profile