What is precise meaning of replicas attribute in Kubernetes?

4/15/2020

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?

-- Yoda
kubernetes

2 Answers

4/15/2020

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

-- Arghya Sadhu
Source: StackOverflow

4/15/2020

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.

-- Shashank V
Source: StackOverflow