Abdullah Şamil Güser

Pods

Pods

Pods_2

Pod Lifecycle

Pod Creation

Pod Creation

Pod Deletion

Pod Deletion

Pod State

Defining and Running Pods

Pod yaml

kubectl - Pod Cheat Sheet

# Create a pod
kubectl create -f pod-definition.yaml

# Run a pod
kubectl run [podname] --image=busybox -- /bin/sh -c "sleep 3600"

# List the running pods
kubectl get pods

# Same but with more info
kubectl get pods -o wide

# Show pod info
kubectl describe pod [podname]

# Extract the pod definition in YAML and save it to a file
kubectl get pod [podname] -o yaml > file.yaml

# Interactive mode
kubectl exec -it [podname] -- sh

# Delete a pod
kubectl delete -f pod-definition.yaml

# Same using the pod's name
kubectl delete pod [podname]

See L21-04 for more details.

Init Containers

See L21-06 for more details.