Kubernetes building blocks¶
Kubernetes building blocks are the core architectural components and concepts required to containerize, deploy, and manage workloads within a Kubernetes cluster.^[400-devops-06-kubernetes-basics-readme.md]
Fundamental Prerequisites¶
Before utilizing Kubernetes, workloads must be packaged as containers (e.g., using Docker).^[400-devops-06-kubernetes-basics-readme.md] Containers make specific assumptions regarding their configuration and runtime environment:
* Definition: Workloads are defined via a Dockerfile.^[400-devops-06-kubernetes-basics-readme.md]
* Networking: Applications must serve traffic by exposing specific ports.^[400-devops-06-kubernetes-basics-readme.md]
* Configuration: Containers consume configuration and secrets via mounted files or environment variables.^[400-devops-06-kubernetes-basics-readme.md]
* Persistence: By default, data is lost when a container terminates; persistent storage strategies are required for stateful applications.^[400-devops-06-kubernetes-basics-readme.md]
* Entrypoint: The container runs a main process, which is typically the application itself.^[400-devops-06-kubernetes-basics-readme.md]
Cluster and Resource Management¶
kubectl is the command-line tool used to manage and interact with a Kubernetes cluster.^[400-devops-06-kubernetes-basics-readme.md] Resources can be organized logically using Namespaces to isolate different environments or projects (e.g., cms).^[400-devops-06-kubernetes-basics-readme.md]
Storage and Configuration¶
- ConfigMaps: These are used to inject non-sensitive configuration data into pods, often as environment variables.^[400-devops-06-kubernetes-basics-readme.md]
- Secrets: Similar to ConfigMaps, but designed specifically to hold sensitive data such as passwords or keys.^[400-devops-06-kubernetes-basics-readme.md]
- StorageClass: Defines the classes of storage available in the cluster (e.g., standard, ssd).^[400-devops-06-kubernetes-basics-readme.md]
- Persistent Volumes: These provide the actual storage resources requested by stateful workloads to ensure data survives Pod restarts.^[400-devops-06-kubernetes-basics-readme.md]
Workload Management¶
Kubernetes provides different controllers for managing the lifecycle of applications, typically distinguishing between stateless services and databases.
- Deployments: Used to manage stateless applications. They handle the creation and scaling of pods, ensuring the desired state of the workload is maintained.^[400-devops-06-kubernetes-basics-readme.md]
- StatefulSets: Designed for stateful applications like databases that require stable network identifiers and persistent storage.^[400-devops-06-kubernetes-basics-readme.md]
Networking¶
Networking blocks connect the running workloads to each other and to the outside world.
- Services: These provide a stable network endpoint (IP or DNS) to access a dynamic group of pods.^[400-devops-06-kubernetes-basics-readme.md]
- Port Forwarding: A mechanism to access private service endpoints or specific pods locally via the
kubectlCLI, often used for debugging.^[400-devops-06-kubernetes-basics-readme.md] - Ingress: Used to expose HTTP/HTTPS routes to the outside world, typically acting as a proxy or API gateway for web servers.^[400-devops-06-kubernetes-basics-readme.md] Using an Ingress requires an Ingress Controller to be running in the cluster.^[400-devops-06-kubernetes-basics-readme.md]
Related Concepts¶
- [[Docker]]
- DevOps
- [[Microservices]]
Sources¶
^[400-devops-06-kubernetes-basics-readme.md]