The K8s documentation describes containers and pods pretty well. But in essence:
A pod in the K8s context
- A group of containers
- Containers share networking. For example, the same IP address
- Typically multi-container pods are used when you need a sidecar container. For example:
- A proxy process to your main container.
- A debug container with utilities.
- A process that always needs to run together with your app.
- A container that does some sort of networking changes that your app needs.
- Allows you to set up a securityContext for all the pods in the container.
- Allows you to set up a Disruption Budget policy to prevent downtime for example.
- Allows you to use higher-level Kubernetes abstractions like Deployments, StatefulSets and Jobs.
- Allows you to set Pod presets so that a pattern can be reused.
A container in the K8s context
- A lower-level abstraction from a pod
- Allows you to specify the image
- Allows you to specify resources (mem/cpu)
- Allows you to setup Liveness, Startup, and Readiness Probes.
- Allows you to set up a securityContext just for the container individually