Yoda
Yoda

Reputation: 18068

What is precise meaning of replicas attribute in Kubernetes?

In documentation of Kubernetes IO, the replicas attribute is explained using itself in the definition thus it doesn't give precise information. Does value replicas: 1 in yaml means there is 1 pod xor that there are 2 pods: 1 original plus 1 duplicate of it? Is the default 0 or 1?

Upvotes: 1

Views: 137

Answers (2)

Arghya Sadhu
Arghya Sadhu

Reputation: 44559

As explained below replicas means desired number of pods.

kubectl explain deployment.spec.replicas
KIND:     Deployment
VERSION:  apps/v1

FIELD:    replicas <integer>

DESCRIPTION:
     Number of desired pods. This is a pointer to distinguish between explicit
     zero and not specified. Defaults to 1.

https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.13/#deploymentspec-v1beta1-apps

Upvotes: 3

Shashank V
Shashank V

Reputation: 11183

replicas is the number of pods that you want the controller i.e., deployment, replicaset or statefulset controller to create from the given spec.template pod template. It defaults to 1 if not specified.

replicas: 1 means 1 pod in total.

Upvotes: 1

Related Questions