Scaling application in kubernetes

Let's say we have a need to scale the number of NGINX pods from three to five. The first thing we're going to do is create the nginx-deploy.yaml file.

Nginx-deploy.yaml

apiVersion: apps/v1

kind: Deployment

metadata:

  name: nginx-deployment

  labels:

    app: nginx

spec:

  replicas: 3

  selector:

    matchLabels:

      app: nginx

  template:

    metadata:

      labels:

        app: nginx

    spec:

      containers:

      - name: nginx

        image: nginx:1.14.2

        ports:

        - containerPort: 80

Save and close the file

Run the kubectl command.

# kubectl apply -f nginx-deploy.yaml

deployment.apps/nginx-deployment configured

Check the status of the pod using below command:

We should see that nginx-deployment is listed with 3/3 Pods ready

With our deployment created, we can now scale it up. Let's say we have a need to scale the number of NGINX pods from three to five

For that run the below command.

root@ciskubemaster:~/kubernetes/scaling# kubectl scale deployments/nginx-deployment --replicas=5
deployment.apps/nginx-deployment scaled

Check the status of the pod using the below command:




Relevant Blogs:

Deploying kubernetees dashboard 

Service Now 

Kubernetes Cheat sheet  

Nagios installation and configuration


Recent Comments

No comments

Leave a Comment