pods-and-containers.md (804B)
1 +++ 2 title = 'Pods and Containers' 3 +++ 4 ## Pods and Containers 5 Pod: smallest unit you can deploy to Kubernetes cluster 6 - generally contains single container 7 - may contain multiple containers that are strictly related: share same net and storage resources 8 - may contain one or more init containers, used to initialize application 9 10 On the command line, run a pod with: 11 12 ```sh 13 kubectl run --image <image-name> <pod-name> --port=<port-on-container-ip> --hostport=<port-on-host-ip> 14 ``` 15 16 Pod lifecycle has phases: 17 1. Pending: cluster accepted pod, not all containers running yet. 18 2. Running: pod bound to node, all containers created, at least one running/starting/restarting. 19 3. - Succeeded: containers terminated successfully, will not restart. 20 - Failed: all containers terminated, at least one with error.