Skip to content

Latest commit

 

History

History
71 lines (61 loc) · 3.86 KB

scaling.adoc

File metadata and controls

71 lines (61 loc) · 3.86 KB

Scaling

Duration: 5:00

We have seem that ReplicationControllers keep the same ammount of replicas running. Let’s check the number of pods again. Execute:

[vagrant@rhel-cdk kubernetes]$ kubectl get pods
NAME                             READY     STATUS    RESTARTS   AGE
frontend-ui-6jy22                1/1       Running   0          24m
frontend-ui-7tcgx                1/1       Running   0          24m
guestbook-service-gxjnx          1/1       Running   0          19m
helloworld-service-vertx-edux9   1/1       Running   0          20m
helloworld-service-vertx-lq1m0   1/1       Running   0          21m
mysql-q9k7p                      1/1       Running   0          21m

Scaling the number of replicas of our Hello World service is as simple as running :

[vagrant@rhel-cdk kubernetes]$ kubectl scale rc helloworld-service-vertx --replicas=6
replicationcontroller "helloworld-service-vertx" scaled

You can very quickly see that the replication controller has been updated:

[vagrant@rhel-cdk kubernetes]$ kubectl get rc
CONTROLLER                 CONTAINER(S)               IMAGE(S)                                      SELECTOR                                          REPLICAS   AGE
frontend-ui                frontend-ui                rafabene/microservices-frontend:1.0           app=frontend-ui                                   2          8m
guestbook-service          guestbook-service          rafabene/microservices-guestbook:1.0          app=guestbook-service,lab=kubernetes-lab          1          2m
helloworld-service-vertx   helloworld-service-vertx   rafabene/microservices-helloworld-vertx:1.0   app=helloworld-service-vertx,lab=kubernetes-lab   6          3m
mysql                      mysql                      openshift/mysql-56-centos7                    app=mysql,lab=kubernetes-lab                      1          4m

[vagrant@rhel-cdk kubernetes]$ kubectl get pods
NAME                             READY     STATUS              RESTARTS   AGE
frontend-ui-6jy22                1/1       Running             0          26m
frontend-ui-7tcgx                1/1       Running             0          26m
guestbook-service-gxjnx          1/1       Running             0          22m
helloworld-service-vertx-1rdd4   0/1       ContainerCreating   0          2s
helloworld-service-vertx-cbevk   0/1       ContainerCreating   0          2s
helloworld-service-vertx-edux9   1/1       Running             0          22m
helloworld-service-vertx-lq1m0   1/1       Running             0          23m
helloworld-service-vertx-lt0k9   0/1       ContainerCreating   0          2s
helloworld-service-vertx-t8z4i   0/1       ContainerCreating   0          2s
mysql-q9k7p                      1/1       Running             0          23m

Reduce the number of replicas back to 2 so that we can free up resources for the later labs:

[vagrant@rhel-cdk kubernetes]$ kubectl scale rc helloworld-service-vertx --replicas=2