Docker and Compose can run a multi-container application on one machine, but they do not spread it across servers for scale or high availability. Kubernetes is a container orchestrator: give it an application model, and it assigns containers to machines, arranges networking and storage, and works to keep the application running. section 1.3 section 15.0
A Kubernetes cluster groups machines called nodes, each with a container runtime. Applications are described as YAML objects and sent to the cluster with kubectl. Start locally with the Docker Desktop cluster; select it with `kubectl config use-context docker-desktop`, then check it with `kubectl get nodes`. section 15.1
The first objects to recognize are:
- A Pod runs one or more containers. Its spec names the containers and their images; if a container exits, the Pod starts a replacement. section 15.2
- A Service routes traffic to Pods selected by labels, so an application can be reached through a defined port. section 15.2
- A ConfigMap stores configuration as key-value data or file content. A Pod can receive that data through environment variables or mounted files. section 15.4
A YAML object identifies its API version, kind and name, then supplies its specification. These models are more verbose than Compose files, and the concepts do not map directly. Begin with a Pod and Service before modeling a larger application. section 15.2 section 15.1
Listing 15.1 A basic Pod spec
apiVersion: v1
kind: Pod
metadata:
name: pi
spec:
containers:
- name: pi
image: kiamol/ch05-pi
This minimal Pod spec shows the four core YAML fields and an image for its container. section 15.2
Deploy and check a Pod
Run `kubectl apply -f ch15/exercises/pi/pod.yaml`, then `kubectl get pods` and `kubectl logs pi`. This example prints pi and exits; watch with `kubectl get pods --watch` to see Kubernetes restart it. A continuously running application is a better fit for this Pod behavior. section 15.2
For production, weigh a managed Kubernetes service against a managed container service. Kubernetes supports many application types and offers portability across providers, but its learning curve is steep; administering your own cluster also takes dedicated effort. Static YAML can become awkward when environments need different settings, which is a reason to explore Helm or Kustomize after learning the API. section 15.1 section 15.5 section 22.3





















