hotnet 发表于 2018-1-5 14:30:32

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   

  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  
页: [1]
查看完整版本: useful commands for Kubernetes beginners