While our app now works fully and is reachable by external sources, what happens if our pod fails? Or what happens if the number of requests reaching our program suddenly spikes?
To protect against these cases, we need to scale up our app; creating more instances of our hello-node pod to delineate requests to or to step in if a pod fails. The best part is, with Kubernetes this takes but a single command to create and will do the above jobs automatically from then on!
To scale up our app, enter:
kubectl scale --replicas=3 deployment/hello-node
This will set our program to maintain a state of three running instances of the hello-node pod rather than just one.
To check this, enter:
kubectl get deployment hello-node
This should print a screen like so:
NAME READY UP-TO-DATE AVAILABLE AGE
hello-node 3/3 3 3 135m
Notice the three pods under this deployment listed in the ready column.
Or to see the pods independently you can enter:
kubectl get pods
NAME READY STATUS RESTARTS AGE
hello-node-55b49fb9f8-fxjnj 1/1 Running 0 2m34s
hello-node-55b49fb9f8-jlfwq 1/1 Running 0 2m34s
hello-node-55b49fb9f8-zhf9f 1/1 Running 0 136m
This once again shows us that where there was once only a single pod, we now have three separate but identical instances of the hello-node pod.