Pods contd..
- Pods will have 4 types of containers in it
- containers: These are main containers where the applications run
- sidecar container: These are contianers which add additional functionality such as agents (log, monitoring etc) to the application Refer Here
- init-container: These containers are created in a sequential order before the main containers. These containers are used to do configuration. init containers are supposed to be running for a finite time. Main containers are created after init containers have finished executing
- ephmeral containers: they are present for debugging purposes & are not part of Pod lifecycle, we inject this container with
kubectl debugcommand
- Watch classroom video for pod creation order
apiVersion: v1
kind: Pod
metadata:
name: httpd-pod
spec:
containers:
- name: httpd
image: httpd:latest
- name: sidecar
image: alpine
args:
- sleep
- 1d
initContainers:
- name: test1
image: alpine
args:
- sleep
- 20s
- name: test2
image: alpine
args:
- sleep
- 20s

- Kubernetes Pod Lifecycle
- For Kubernetes Pod the desired state is to ensure the containers in Pod are in running state. For any reason if the contianer gets into exited state, Pod will retry restarts continuously. This state is referred as
CrashLoopBackOff
