A replica is an independently running copy of a pod or application instance. Multiple replicas provide workload capacity, redundancy, and fault tolerance when one pod is unavailable. Kubernetes commonly manages replicas through a Deployment and its ReplicaSet. section 5.1.1
Use replicas to:
- Run multiple copies of a stateless application so requests receive the same response from any instance. section 5.1.1
- Increase or decrease application capacity by scaling a Deployment. section 5.1.1
- Improve DNS query performance by scaling CoreDNS replicas. section 6.2.3
- Recognize pods belonging to the same Deployment by their shared prefix and unique hash suffix. section 5.1.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 with `kubectl scale deploy apache --replicas 5`, and verify the five running pods with `kubectl get po`. Change the image using `kubectl set image deploy apache httpd=httpd:alpine`, then inspect the newly created pods. section 5.1.1
root@kind-control-plane:/# kubectl -n kube-system get po NAME READY STATUS RESTARTS AGE coredns-565d847f94-4pnf4 1/1 Running 0 143m coredns-565d847f94-xstnx 1/1 Running 0 143m etcd-kind-control-plane 1/1 Running 0 143m kindnet-75z9k 1/1 Running 3 (46m ago) 143m kube-apiserver-kind-control-plane 1/1 Running 0 94m kube-controller-manager-kind-control-plane 1/1 Running 1 (95m ago) 143m kube-proxy-s5vps 1/1 Running 0 143m kube-scheduler-kind-control-plane 1/1 Running 1 (95m ago) 143m
Inspect CoreDNS replicas, scale them from two to three, and observe how scaling them to zero removes cluster DNS resolution. section 6.2.3











