#HelloWorld SAPUI5 meets Kubernetes – Scalability Replicasets
All Blogs in the series
|1||Docker Set up by Ronnie André Bjørvik Sletta|
|2||Hello World – Containers|
|3||Container meet Orchestrator|
|6||Secrets and Configurations|
PS: Live demo at the end.
In one of our previous blog, Jakob commented about scalability, so i thought of digging bit more into it to understand how it works. If you remember we have created a deployment for our application with ReplicaSet as 4 so what is Replicaset?
What is Replicaset?
K8s uses the concept of Replicaset to handle scalability. Earlier it was handled by Replica Controller. So when we mentioned 4 as the replicaset what we meant is we want 4 pods of our application running anytime. If one pod gets killed then k8s make sure a new pod is created automatically.
So now we understand at a very basic level how replicatsets work, lets see them in action.
Lets see Replicaset in action?
We have created a deployment with 4 pods as can be seen below.
apiVersion: extensions/v1beta1 kind: Deployment metadata: name: ui5 spec: replicas: 4 template: metadata: labels: app: ui5 spec: containers: - name: ui5 image: nabheetmadan/helloworldui5:2.0 ports: - containerPort: 80
Lets kill a pod and you will notice one more pod is created
kubectl delete pod <podid> kubectl get all
Now lets scale up our deployment to have 20 replicasets
kubectl scale deployment ui5 --replicas=20
As can be seen we have 20 pods running
On a similar lines when we scale down to 2 for example it is automatically terminating the pods
kubectl scale deployment ui5 --replicas=2
What is next?
We have seen one of the way how k8s handle scalability. Scalability is a pretty vast topic and we will keep exploring different stuff like Ingress how it handles the external workload and all. Apart from this it is also important to understand how we upgrade our pod’s and all. We will explore them in more details.