Scaling

When load increases , we can scale the pods using deployment scaling

$ kubectl scale deployment --replicas=3 nginx
$ kubectl get pods

Output

NAME                     READY   STATUS    RESTARTS   AGE
nginx-7cdbd8cdc9-4lhh4   1/1     Running   0          6s
nginx-7cdbd8cdc9-mxhnl   1/1     Running   0          6s
nginx-7cdbd8cdc9-vfbn8   1/1     Running   0          14m

Lets see the endpoints of service

$ kubectl get ep nginx-svc

Output

NAME        ENDPOINTS                                         AGE
nginx-svc   10.10.36.201:80,10.10.36.202:80,10.10.36.203:80   5m40s

Endpoints will be automatically mapped , because when we scale the deployment , the newly created pod will have same label which matches the Service selector.