How many pods can be configured per deployment in kubernetes?

8/16/2019

As per the Kubernetes documentation there is 1:1 correspondence between Deployment and ReplicaSets. Similarly depending on the replicas attribute , a ReplicaSet can manage n number of pods of same nature. Is this a correct understanding ?

Logically (assuming Deployment is a wrapper/Controller) I feel Deployment can have multiple replicaSets and each replicaSet can have multiple Pods (same or different kind). If this statement is correct, can some one share an example K8S template ?

-- user3364247
containers
kubernetes
kubernetes-pod
replicaset

2 Answers

8/16/2019

1.) Yes, a Deployment is a ReplicaSet, managed at a higher level.

2.) No, a Deployment can not have multiple ReplicaSets, a Deployment pretty much IS a ReplicaSet. Typically you never use a ReplicaSet directly, Deployment is all you need. And no, you can't have different Pod templates in one Deployment or ReplicaSet. The point of replication is to create copies of the same thing.

As to how many pods can be run per Deployment, the limits aren't really per Deployment, unless specified. Typically you'd either set the wanted number of replicas in the Deployment or you use the Horizontal Pod Autoscaler with a minimum and a maximum number of Pods. And unless Node limits are smaller, the following limits apply:

  • No more than 100 pods per node
  • No more than 150000 total pods

https://kubernetes.io/docs/setup/best-practices/cluster-large/

-- Markus Dresch
Source: StackOverflow

8/16/2019

As per the Kubernetes documentation there is 1:1 correspondence between Deployment and ReplicaSets. Similarly depending on the replicas attribute , a ReplicaSet can manage n number of pods of same nature. Is this a correct understanding ?

Yes. It will create no of pods equal to value to the replicas field value. Deployment manages a replica set, you don't/shouldn't interact with the replica set directly.

Logically (assuming Deployment is a wrapper/Controller) I feel Deployment can have multiple replicaSets and each replicaSet can have multiple Pods (same or different kind). If this statement is correct, can some one share an example K8S template ?

When you do a rolling deployment, it creates a new ReplicaSet with the new pods (updated containers), and scales down the pods running in older replica set.
I guess it does not support running two different ReplicaSets(not deployment updates) with different pod/containers.

https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#updating-a-deployment

After the deployment has been updated:
Run:

kubectl describe deployments

Output:

.
.
.
OldReplicaSets:  <none>
NewReplicaSet:   nginx-deployment-1564180365 (3/3 replicas created)
-- Ankit Deshpande
Source: StackOverflow