liveBook · Manning

Replica

As explained in Kubernetes in Action, Second Edition

An application instance is a running replica of an application managed by Kubernetes.

A replica is a running application instance managed by Kubernetes. Replicas let one application run as multiple equivalent instances instead of relying on a single instance. section 1.2.4 section 3.3.3

A Deployment records the desired number of replicas. Kubernetes compares that desired state with the current state, creates or removes Pods as needed, and keeps the application running. section 3.3.3

A replica participates in the application lifecycle as follows:

  • A controller creates objects for application instances after the manifest reaches the Kubernetes API. section 1.2.4
  • The scheduler assigns each instance to a node, and the Kubelet runs it through the container runtime. section 1.2.4
  • A Service can distribute client connections across the Pods containing the replicas. section 3.3.3

Scaling to three replicas

Run `kubectl scale deployment kiada --replicas=3`. Kubernetes changes the Deployment's desired replica count and creates enough additional Pods to reach it. `kubectl get deploy` then reports three available instances, while `kubectl get pods` shows three separate Pods. section 3.3.3

Figure 3.12 Load balancing across multiple pods backing the same service
figure

Shows how a Service load-balances requests across multiple Pods backing the same application. section 3.3.3

How Kubernetes in Action, Second Edition covers it

How deep it goes
Traces replica creation, scheduling, execution, reconciliation, and service traffic without detailing controller internals.
Examples
Demonstrates three replicas with kubectl scale, deployment and Pod listings, node placement, and repeated requests reaching different Pods.
What you can do after
Operate/configure replicas via kubectl by changing a Deployment's desired count and checking resulting Deployments and Pods.
How it connects
Connects replicas to Deployments, Pods, Services, controllers, schedulers, Kubelets, container runtimes, and desired state.

Also explained in

Compare how 12 books explain replica →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kubernetes in Action, Second Edition. The section links point to the parts of the book it draws on.