I'm new to Kubernetes.
I have a question about Kubernetes deployment replicas. kubernetes official web site
If I set replicas on a deployment yaml, does it means replica pods would work at the same time on the cluster? or only one pod would offer services and other replicated pods work like waiting player and will be replaced when working pod shut down accidentally?
For example, if I declare 3 replicas on a deployment yaml, only 1 pod really work on the cluster and other 2 pods waiting for replacement time like when working pod shut down accidentally.
The moment you create the deployment resource, the no of replicas defined in the deployment yaml would be all up and running for serving the required functions exposed by the pod
The short answer is that all replicas serve traffic from the Kubernetes point of view.
You usually expose your replicas through another abstraction called a Service and that essentially balances the requests to the replicas.
From the application point of view, it may vary. For example, if you have an API service you generally serve traffic through all the replicas. On the other hand, if you have a stateful app, it could be that only one replica serves traffic and the others are on standby or just read-only traffic.
Cheers.