Kubernetes Pod Operations: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 9: Line 9:


  kubectl describe pod <''pod-name''>
  kubectl describe pod <''pod-name''>
==Pod Output==


  kubectl log <''pod-name''>
  kubectl log <''pod-name''>
"Follow" logging:
kubectl logs -f <''pod-name''>
This shell command could be used to log a pod in such a way logging survives a pod restart:
while ! kubectl -n my-namespace logs -f my-pod; do sleep 1; done


=<span id='Create_a_Pod'></span>Create Pods=
=<span id='Create_a_Pod'></span>Create Pods=

Revision as of 01:35, 7 September 2019

Internal

Get Information about Pods

kubectl get pods|po
kubectl describe pod <pod-name>

Pod Output

kubectl log <pod-name>

"Follow" logging:

kubectl logs -f <pod-name>

This shell command could be used to log a pod in such a way logging survives a pod restart:

while ! kubectl -n my-namespace logs -f my-pod; do sleep 1; done

Create Pods

A singleton pod can be created by posting a pod manifest to the API server with:

kubectl apply -f <pod-manifest-file-name>.yaml

Removing an Individual Pod

Remove Immediately

kubectl delete pod pod-name --grace-period=0 --force