在k8s从节点执行命令:
[root@node01 kubernetes]# kubectl get nodes
The connection to the server localhost:8080 was refused - did you specify the right host or port?
需要从master节点拷贝admin.conf文件至从节点
[root@master kubernetes]# scp /etc/kubernetes/admin.conf node01:/etc/kubernetes/
The authenticity of host 'node01 (192.168.56.101)' can't be established.
ECDSA key fingerprint is SHA256:y/gg8SzGFiAYT2qxrmAt/03gJZbqdTgR3IAUrXGg1ds.
ECDSA key fingerprint is MD5:4e:d1:25:c0:75:fe:2e:2a:97:f3:59:7d:3f:cf:cb:29.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'node01,192.168.56.101' (ECDSA) to the list of known hosts.
root@node01's password:
admin.conf
在从节点执行命令
[root@node01 kubernetes]# echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile
[root@node01 kubernetes]# source ~/.bash_profile
[root@node01 kubernetes]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
master Ready master 3h27m v1.17.1
node01 Ready <none> 14m v1.17.1
node02 Ready <none> 10m v1.17.1
版权声明:本文为博主原创文章,未经博主允许不得转载。
k8s