k8s中让node节点使用kubectl命令
1.把master上的/etc/kubernetes/admin.conf文件拷贝到node节点上scp /etc/kubernetes/admin.conf root@192.168.47.47:/etc/kubernetes/
2.配置环境变量
echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile
source ~/.bash_profile #立即生效
3.测试
# kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-master Ready master 70d v1.18.0
k8s-node1 Ready <none> 70d v1.18.0
k8s-node2 Ready <none> 70d v1.18.0
页:
[1]