Fig 4Pods, labels & namespacesPick a selector and a namespace below2 pods match app=web in prod
apiVersion: v1
kind: Pod
metadata:name: demo
namespace: dev
labels: { app: demo }
spec:containers: # two containers, one IP, one shared volume
- { name: app, image: myapp:1.4 }
- { name: log-agent, image: fluent-bit:3 }
restartPolicy: Always # a Job's pod uses OnFailure or Never
Lit crate and lamp: the pod matches the selector in the chosen namespaceWorkbench: one pod opened up, two containers sharing an IP and a volumeFailed lamp: the pod's app exited with an error (CrashLoopBackOff when it keeps doing so)A pod is the smallest thing Kubernetes runs: one or more containers that share an IP address and volumes and are always scheduled together. Pods carry labels, free-form key=value tags, and almost everything finds pods through label selectors: Services, Deployments and kubectl -l. Namespaces divide one cluster into named groups for names, access rules and quotas; they are logical and span all nodes. A pod's phase moves from Pending through ContainerCreating to Running, and ends as Succeeded or Failed; a container that keeps crashing is restarted with a growing delay, shown as CrashLoopBackOff.