Skip to main content

Kubernetes CLI

How to restart Pod?

You need to delete the POD and it will be automatically created again:

kubectl delete pods ${POD_NAME}

How to view pod logs?

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

How to display a list of services?

kubectl get services

How to display a list of pods?

kubectl get pods

How to display a list of deployments?

kubectl get deployments

How to execute a command in a container?

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