useful commands for Kubernetes beginners

Get pod ip and their coordinating NODE

$ kubectl get pods -o wide

If you want to get detailed information about pod, nodes, then you should set output as yaml:

$ kubectl get pods -o json

Show labels about pods under all namespace:

$ kubectl get pods --all-namespaces --show-labels

Dump kubernets cluster infomation

$ kubectl cluster-info dump

Run commands in a pod

$ kubectl exec test-pod -- ls -alh

Attach to a process that is already running inside an existing container.

$ kubectl attach POD -c CONTAINER [options]

Sends stdin to a 'bash' in busybox container from pod busy box and sends stdout/stderr from 'bash' back to the client.

$ kubectl attach busybox -it

Get node information, Kubelet, Kube-proxy version, resource utilisation etc.

$ kubectl describe node ip-172-31-10-199

posted on 2016-12-27 23:37  生栋  阅读(410)  评论(0编辑  收藏  举报

导航