K8s ❉ 报错cannot stat ‘/etc/kubernetes/admin.conf’

现象

        报错提示:cannot stat ‘/etc/kubernetes/admin.conf’: No such file or directory

解决方式:

        从master节点拷贝过来

        

# master节点执行
[root@master ~]# scp /etc/kubernetes/admin.conf root@192.168.247.137:/etc/kubernetes/admin.conf
The authenticity of host '192.168.247.137 (192.168.247.137)' can't be established.
ECDSA key fingerprint is SHA256:oj2gG+nDvkzbS+IggsOxKVwMTVP2zxClBoNEPXmHvzk.
ECDSA key fingerprint is MD5:fa:f6:9a:89:1a:4a:54:63:fe:3d:70:88:c4:a4:4d:ea.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.247.137' (ECDSA) to the list of known hosts.
root@192.168.247.137's password: 
admin.conf                                                                    100% 5451     3.5MB/s   00:00    

# node节点执行
[root@slave2 ~]# echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile
[root@slave2 ~]# source ~/.bash_profile
[root@slave2 ~]# chown $(id -u):$(id -g) $HOME/.kube/config

# 验证
[root@slave2 ~]# kubectl get pod
NAME                     READY   STATUS    RESTARTS   AGE
nginx-6867cdf567-vkf99   1/1     Running   0          6m38s

上一篇:BN剪枝实践


下一篇:JS设计模式-命令模式