一般linux获取master控制节点的授权:
[root@harbor ~]# vim /etc/hosts
192.168.1.30 harbor
192.168.1.50 master
192.168.1.51 node-0001
192.168.1.52 node-0002
192.168.1.53 node-0003
192.168.1.54 node-0004
192.168.1.55 node-0005
#下载插件
dnf install -y kubectl
# 管理授权
mkdir -p $HOME/.kube
rsync -av master:/etc/kubernetes/admin.conf $HOME/.kube/config
chown $(id -u):$(id -g) $HOME/.kube/config
#验证
[root@harbor ~]# kubectl get nodes
windows系统获取master控制节点的授权:
先下载kubernetes插件
然后在编辑器的控制台输入:
$ mkdir -p $HOME/.kube
$ scp root@192.168.1.50:/etc/kubernetes/admin.conf $HOME/.kube/config
The authenticity of host '192.168.1.50 (192.168.1.50)' can't be established.
ED25519 key fingerprint is SHA256:vn9vQ+resIqP5JZMCWQrEza8CbygLw0k+q4s9tKV3Hw.
This host key is known by the following other names/addresses:
...
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.1.50' (ED25519) to the list of known hosts.
root@192.168.1.50's password:
admin.conf
$ kubectl.exe get pods
NAME READY STATUS RESTARTS AGE
test2 0/1 CrashLoopBackOff 14 (2m58s ago) 49m
web1 1/1 Running 0 23h
web2 1/1 Running 0 23h
web3 1/1 Running 0 23h
注意:只有cmd控制台的,想要上述的控制台效果,可以将terminal改成git的bash-shell
也可以手动下载,记得要配置环境变量:
kubernetes/CHANGELOG at master · kubernetes/kubernetes · GitHub