A replica is an independently running instance of a workload. In Kubernetes, a Deployment uses its replica count to maintain the desired number of Pods, providing capacity and redundancy. section 15.3
Increasing replicas lets multiple Pods serve traffic. If one fails, the remaining Pods can continue serving requests while the Deployment creates a replacement. A Service distributes requests across matching Pods. section 15.3
Scale an application to three replicas
Run `kubectl scale deploy/numbers-api --replicas 3`, then inspect the matching Pods and Service endpoints. Repeated requests are distributed across the Pods, while a failed Pod can be replaced. section 15.3
Listing 15.4 Deployment spec that includes the templated Pod spec
apiVersion: v1
kind: Deployment
metadata:
name: numbers-api
spec: # this is the Deployment spec
replicas: 1 # the number of Pods to create
selector: # selector to find Pods
matchLabels:
app: numbers
component: api
template: # this is the template for creating Pods
metadata:
labels: # labels the Deployment selector uses
app: numbers
component: api
spec: # and this is the Pod spec
containers:
- name: api # full container spec snipped
Inspect the Deployment template and its `replicas` field alongside the labels that select the managed Pods. section 15.3











