When it comes to interacting with Kubernetes clusters on a daily basis, you’re going to need to turn to kubectl; the command line tool for Kubernetes.
List all services
kubectl get services
kubectl get svc
List everything
kubectl get all --all-namespaces
Describe service <name>
kubectl describe svc <name>
Get services sorted by name
kubectl get services –sort-by=.metadata.name
List all pods
kubectl get pods
Watch nodes continuously
kubectl get pods -w
Get version information
kubectl get version
Get cluster information
kubectl get cluster-info
Get the configuration
kubectl config view
Output information about a node
kubectl describe node <node-name>
List the replication controllers
kubectl get rc
List the replication controllers in specific <namespace>
kubectl get rc -n <namespace-name>
Describe replication controller <name>
kubectl describe rc <name>
Delete pod <name>
kubectl delete pod <name>
Delete replication controller <name>
kubectl delete rc <name>
Delete service <name>
kubectl delete svc <name>
Remove <node> from the cluster
kubectl delete node <name>
Show metrics for nodes
kubectl top nodes
Show metrics for pods
kubectl top pods
Watch the Kublet logs
watch -n 2 cat /var/log/kublet.log
Get logs from service <name>, optionally selecting container <$container>
kubectl logs -f <name> [-c <$container>]
execute <command> on <service>, optionally selecting container <$container>