0
点赞
收藏
分享

微信扫一扫

k8s基础-kubectl node-shell 登录节点

香小蕉 2022-04-23 阅读 134
kubernetes

通过kubectl node-shell可以直接登录任意节点主机:

(weops) [root@node201 helm]# curl -LO https://github.com/kvaps/kubectl-node-shell/raw/master/kubectl-node_shell
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   150  100   150    0     0    123      0  0:00:01  0:00:01 --:--:--   123
100  3438  100  3438    0     0   1405      0  0:00:02  0:00:02 --:--:--  8013
(weops) [root@node201 helm]# chmod +x ./kubectl-node_shell
(weops) [root@node201 helm]# sudo mv ./kubectl-node_shell /usr/local/bin/kubectl-node_shell

(weops) [root@node201 helm]# kubectl get node
NAME      STATUS   ROLES                  AGE   VERSION
node2     Ready    control-plane,master   91d   v1.20.2
node201   Ready    <none>                 91d   v1.20.2

(weops) [root@node201 helm]# kubectl node-shell node2
spawning "nsenter-xhadg3" on "node2"
If you don't see a command prompt, try pressing enter.
[root@node2 /]# hostname
node2
[root@node2 /]# exit
logout
pod "nsenter-xhadg3" deleted
(weops) [root@node201 helm]#

举报

相关推荐

0 条评论