Managing Kubernetes Applications with Deployments

Introduction

Deployments offer a wide range of features for automating application management. In this lab, you will put your knowledge of deployments to the test. You will use an existing deployment to scale an application, as well as perform a rolling update.

Solution

Log in to the Control Plane Node server using the credentials provided:

ssh cloud_user@<PUBLIC_IP_ADDRESS>

Update the App to a New Version of the Code

  1. Edit the beebox-web deployment:

    kubectl edit deployment beebox-web
    
  2. Locate the Pod’s container specification, and change the 1.0.1 image version tag to 1.0.2:

    ...
    
    spec:
      containers:
      - image: acgorg/beebox-web:1.0.2
        imagePullPolicy: IfNotPresent
        name: web-server
    
    ...
    
  3. Save and exit the file by pressing Escape followed by :wq.

  4. Check the status of your deployment to watch the rolling update occur:

    kubectl rollout status deployment.v1.apps/beebox-web
    

Scale the App to a Larger Number of Replicas

  1. Scale the deployment to 5 replicas:

    kubectl scale deployment.v1.apps/beebox-web --replicas=5
    
  2. View the deployment to watch it scale up:

    kubectl get deployment beebox-web
    
  3. View the Pods:

    kubectl get pods