Skip to main content

Kubernetes CLI

warning

This document has been translated using machine translation without human review.

How to restart a POD?​

To restart a POD, you need to delete it, it will be restarted automatically:

kubectl delete pods ${POD_NAME}

How to view the log of a specified POD?​

kubectl logs ${POD_NAME}
kubectl logs ${POD_NAME} -c ${CONTAINER_NAME}

How to view the list of services?​

kubectl get services

How to view the list of pods?​

kubectl get pods

How to view the list of deployments?​

kubectl get deployments

How to execute a command in a container?​

kubectl exec --stdin --tty ${POD_NAME} -- /bin/sh