Running pods
Kubernetes organizes containers into pods. Each pod is a collection of one or more containers. A pod can be replicated, scaled, and updated independently of other pods running in the cluster. Each pod is assigned an IP address, which is used to connect to the exposed ports of containers running in the pod. Care must be taken to ensure that services within a pod do not try to use the same port, but that is much easier to coordinate than managing port usage across a Docker Swarm.
Defining a pod
Pods define one or more containers as well as all of the volumes that the containers need. The containers operate as a single unit. They are all started and stopped together. They can also communicate with each other on localhost. The pod is defined using YAML or JSON and passed to kubectl create
. Following is a simple pod definition:
apiVersion: v1 kind: Pod metadata: name: simple spec: containers: - name: web image: nginx ...