Skip to content

Container fundamentals for Kubernetes

Before deploying workloads to Kubernetes, a general understanding of containers (such as Docker) is required^[400-devops-06-kubernetes-basics-readme.md]. Applications must be packaged as containers to be scheduled and run on the cluster^[400-devops-06-kubernetes-basics-readme.md].

Key Characteristics

Containers operate under specific assumptions regarding state and lifecycle that distinguish them from traditional virtual machines or physical servers^[400-devops-06-kubernetes-basics-readme.md].

  • Immutability: When a container terminates, everything inside the container is lost^[400-devops-06-kubernetes-basics-readme.md]. This implies that data cannot be reliably stored within the container's file system if it must persist beyond the container's life.
  • Entrypoint: The container's lifecycle is tied to a specific main process defined as the entrypoint^[400-devops-06-kubernetes-basics-readme.md]. If this process stops, the container stops.

Configuration Requirements

To function correctly within a Kubernetes environment, containers must adhere to specific configuration standards^[400-devops-06-kubernetes-basics-readme.md].

  • Definition: Containers are defined via a Dockerfile, which specifies the base image, application code, and dependencies^[400-devops-06-kubernetes-basics-readme.md].
  • Networking: Applications must serve traffic by exposing specific ports^[400-devops-06-kubernetes-basics-readme.md].
  • Configuration Management: Application settings should be externalized using mechanisms such as mounted configuration files, secrets, or environment variables^[400-devops-06-kubernetes-basics-readme.md].
  • Data Persistence: Because containers are ephemeral, persistent data requires external storage solutions, such as volume mounts^[400-devops-06-kubernetes-basics-readme.md].

Sources

^[400-devops-06-kubernetes-basics-readme.md]