kube commands
kube commands
查看pod所在node信息
-o wide可以输出节点信息.
kubectl get pod --all-namespaces -o wide
https://stackoverflow.com/questions/48983354/kubernetes-list-all-pods-and-its-nodes
为什么 kubectl命令进入容器需要有--
之前一直有个疑问, docker进入容器命令是
docker exec -it mycontainer bash
kubectl进入容器, 总是要额外多两个横线 --, 不知道什么用途.
kubectl exec -it mypod -n namespaceA -- bash
原来 -- 是bash里的语法, 说明后面的不需要作为这个命令的选项解析, 而是作为参数传递到后面.
还是得看下人工解释才放心一点: -- to signify the end of the options.
https://unix.stackexchange.com/questions/11376/what-does-double-dash-mean
In man bash we can read in Shell Builtin Commands section:
Unless otherwise noted, each builtin command documented in this section as accepting options preceded by
-accepts--to signify the end of the options. The :, true, false, and test builtins do not accept options and do not treat -- specially. The exit, logout, break, continue, let, and shift builtins accept and process arguments beginning with - without requiring --. Other builtins that accept arguments but are not specified as accepting options interpret arguments beginning with - as invalid options and require -- to prevent this interpretation. Note that echo does not interpret -- to mean the end of options
