Managing Deployments Using Kubernetes Engine

📒 link

Overview

  • Goal

    • Practice in scaling and managing containers so you can accomplish these sommon scenarios where multiple heterogeous deployments are being used.

  • Deployment scenarios

    • Continuous Deployment

    • Blue-Green Deployments

    • Canary Deployments

  • What you’ll do

    • Practice with kybectl tool

    • Create deployment yaml files

    • Lanch, update, and scale deployments

    • Practice with updating deployments and deployment styles

Introduction to deployments

  • What is Heterogeneous deployment

    • Typically involve connecting two or more distinct infrastructure environments or regions to address a specific technical or operarion need.

    • Heterogeneout Deployments are called “hybrid”, “multi-cloud”, or “public-private”, depending upon the specifics of the deployment.

    • Hetetogeneous deployments include those tht span regions within a single cloud environment, multiple public cloud envieonments (multi-cloud), or a combination of on-preises and public cloud environments (hybrid or public-private).

  • Single environment or region’s business and technical challenges

    • Maxed out resources: In any single environment, particularly in on-premises environments, you might not have the compute, networking, and storage resources to meet your production needs.

    • Limited geographic reach: Deployments in a single environment require people who are geographically distant from one another to access one deployment. Their traffic might travel around the world to a central location.

    • Limited availability: Web-scale traffic patterns challenge applications to remain fault-tolerant and resilient.

    • Vendor lock-in: Vendor-level platform and infrastructure abstractions can prevent you from porting applications.

    • Inflexible resources: Your resources might be limited to a particular set of compute, storage, or networking offerings

H.P can help address these challenges, but they must be architected using programmatic and deterministic processes and procedures. One-off or ad-hoc deployment procedures can cause deployments or processes to be brittle and intolerant of failures

  • Three common scenarios for heterogeneous deployment

    • multi-cloud deployments

    • fronting on-premises data

    • continuous

Ref

Setup

✔️ Set zone

✔️ Get sample code

Learn about the deployment object

✔️ Take a look at the Deployment object.

See all of the fields using the —recursive option

Go through the lab to help you understand the structure of a Deployment object and understatnd what the individual fields do.

Create a deployment

✔️ Update the deployments/auth.yaml configuration file

Change the image in the containers section of the Deployment to the following

✔️ Create a simple deployment

(Output)

When you run the kubectl create command to create the auth deployment, it will make one pod that conforms to the data in the Deployment manifest. This means we can scale the number of Pods by changing the number specified in the replicas field.

Create deployment

Verify that deployment was created

Verify that a ReplicaSet was created for Deployment

✔️ View the Pods that were created as part of our Deployment.

The single Pod is created by the Kubernetes when the ReplicaSet is created

✔️ Create service for our auth deployment.

✔️ Create and expose the deployment

  • What is Configmap ?

    • API object used to store non-confidential data in key-value pairs.

  • What is Secrets ?

    • Object that contains a small amount of sensitive data such as a password, a token, or a key.

✔️ Interact with the frontend by grabbing its external IP and then curling to it

Use the output templating feature

✔️ Scale a Deployment

Verify that there are now 5 hello Pods running

Scale back the application

Verify that you have the corrext number of Pods

Rolling update

https://cdn.qwiklabs.com/uc6D9jQ5Blkv8wf%2FccEcT35LyfKDHz7kFpsI4oHUmb0%3D

✔️ Trigger a rolling update

Update Deployment

Change the image in the containers section of the Deployment to the following

See the new ReplicaSet

See a new entry in the rollout history

✔️ Pause a rolling update

If you detect problems with a running rollout, pause it to stop the update.

Verify the current state of the rollout

Verify this on the Pods dirextly

✔️ Resume a rolling update

✔️ Rollback an update

Roll back to the previous version

Verify the rollback in the history

Verify that all the Pods have rolled back to their previous versions

Canary deployments

Canary deployments allow you to release a change to a small subset of your users to mitigate risk associated with new releases.

A canary deployment consists of a separate deployment with your new version and a service that targets both your normal, stable deployment as well as your canary deployment.

https://cdn.qwiklabs.com/qSrgIP5FyWKEbwOk3PMPAALJtQoJoEpgJMVwauZaZow%3D

✔️ Create a canary deployment

(output)

✔️ Verify the canary deployment

✔️ Canary deployments in production - session affinity

All clients with the same IP address will have their requests sent to the same version of the hello application.

Blue-green deployments

Use your existing hello deployment for the "blue" version. The deployments will be accessed via a Service which will act as the router. Once the new "green" version is up and running, you'll switch over to using that version by updating the Service.

https://cdn.qwiklabs.com/POW8Q247ZKNY%2ByHIartCsoEu8MAih7k4u1twusCx6pw%3D

✔️ The service

Update the service

✔️ Updating using Blue-Green Deployment

Create a “green” deployment for new version

Create the green deployment

Verify thT the srrent version of 1.0.0 is still being used

Update the service to point to the new version

Verify that the new version is always being used

✔️ Blue-Green Rollback

You can rollback to the old version in the same way. While the ‘blue” deployment is still running, just update the service back to the old version.

Verify that the right version is now being used

12

Last updated