kubectl 获取信息

时间:2024-04-05 17:33:40

获取pod所在节点的ip

kubectlget po tiller-deploy-8694f8fddc-c2rql -n kube-system -o jsonpath='{.status.hostIP}'

获取pod 所在节点的主机名

kubectl describe po tiller-deploy-8694f8fddc-c2rql -n kube-system|grep 'Node:'|awk '{print $2}'|awk -F '/' '{print $1}'

获取pod所有容器id

docker ps|grep tiller-deploy-8694f8fddc-c2rql|grep -v pause-amd64|awk '{print $1}'

获取pod image id or name

docker ps|grep tiller-deploy-8694f8fddc-c2rql|grep -v pause-amd64|awk '{print $2}'