ReplicaSet

Deployments do not require the pods

or rather, not directly

kubectl get replicasets

NAME				DESIRED		CURRENT		READY	AGE
nginx-85b98978db	1			1			1		42s
	

There is another resource related our Deployment

Remember when we talked
about horizontal scalability?

ReplicaSet is a resource provides this capability
to our stateless services

Exploiting it we can choose how many copies of our services we want to deploy on the cluster workers

When we created the deployment this did not require directly the pod deployment

Instead it required the creation of a replicaset

Which in turn requested the pod scheduling

kubectl scale --replicas=COUNT RESOURCE_TYPE RESOURCE_NAME
scale
changes the required amount of replicas associated to a resource

In our case we can scale directly the deployment

kubectl scale --replicas=4 deployment nginx
deployment.apps/nginx scaled
kubectl get replicasets

NAME				DESIRED		CURRENT		READY	AGE
nginx-85b98978db	4			1			1		6m5s
	

The replicaset has been informed of the change,
but it is still working on it...

...after a while we get


NAME				DESIRED		CURRENT		READY	AGE
nginx-85b98978db	4			4			4		7m13s
	

If we look at pods

kubectl get pods

NAME						READY	STATUS		RESTARTS	AGE
nginx-85b98978db-c87qt		1/1		Running		0			102s
nginx-85b98978db-f7jn9		1/1		Running		0			102s
nginx-85b98978db-k8t6n		1/1		Running		0			102s
nginx-85b98978db-mpnlw		1/1		Running		0			7m33s
	

A little tip:

If you need to temporarily shut down a service, but you do not want to delete the deployment you can scale it to zero