A stateless application does not retain essential client or session data inside individual instances between requests. Because application data is decoupled from its containers, Kubernetes can replace failed pods or distribute requests across replicas without changing the expected response. section 5.1 section 5.1.1
Use a Deployment to operate stateless workloads:
- Run multiple identical pod replicas for high availability, resilience, robustness, and self-healing. section 5.1 section 5.1.2
- Scale replicas independently with kubectl scale or by changing the Deployment YAML. section 5.1.1 section 5.1.2
- Update container images through a rolling update; Kubernetes creates a new ReplicaSet and replaces the old pods. section 5.1.1 section 5.1.2
- Contrast this model with StatefulSet workloads, whose data is required for the application to run and prevents equally simple replacement. section 5.1
Scale and update an Apache Deployment
Create three replicas with `kubectl create deploy apache --image httpd:2.4.65 --replicas 3`, verify them with `kubectl get deploy`, scale to five using `kubectl scale deploy apache --replicas 5`, then change the image with `kubectl set image deploy apache httpd=httpd:alpine`. Verify the replacement pods with `kubectl get po`. section 5.1.1
root@kind-control-plane:/# kubectl create deploy apache --image httpd:2.4.54 --replicas 3 deployment.apps/apache created root@kind-control-plane:/# kubectl get deploy NAME READY UP-TO-DATE AVAILABLE AGE apache 3/3 3 3 14s root@kind-control-plane:/# kubectl scale deploy apache --replicas 5 deployment.apps/apache scaled root@kind-control-plane:/# kubectl get po NAME READY STATUS RESTARTS AGE apache-74f79bcc68-7lzqz 1/1 Running 0 7s apache-74f79bcc68-89zwg 1/1 Running 0 33s apache-74f79bcc68-v6drf 1/1 Running 0 33s apache-74f79bcc68-x7bfw 1/1 Running 0 33s apache-74f79bcc68-xdx4b 1/1 Running 0 7s
Inspect representative kubectl output showing Deployment scaling, pod naming, and the resulting replica set. section 5.1.1













