Ready for the real environment experience?
Creating well structured, declarative, and reusable deployments within Kubernetes is an essential skill which increases productivity. Using the right cluster resources for the right job, combined with knowing how to templatize your setups minimises the risk of making mistakes across multiple environments and helps to reduce ongoing maintenance. This Lab will introduce you to the concept of a manifest file, used for declaring your cluster resources, together with Helm (v3) which can be used to templatize your manifests.
In this Lab scenario you'll work with 2 containers. An NGINX web server container will be configured to proxy incoming HTTP requests downstream to another container running a customised FLASK based web application. The NGINX web server container will use the publicly available nginx:1.13.7 image. The FLASK based web application container will be based on a custom docker image that you will need to first create.
This Lab will teach you how to create a ConfigMap manifest file, and a Deployment manifest file. You will then use the kubectl apply command to create both resources within a Kubernetes cluster. You'll then learn how to use Helm to reconstruct the entire deployment using templates, allowing you to create and deploy environment specific versions, dev and prod, of the deployment within the cluster.
Upon completion of this Lab, you will be able to:
- Work with a Kubenetes 1.22 cluster
- Work with Helm 3
- Use the docker build command to build a new Docker Image and tag it with cloudacademydevops/flaskapp:latest
- Update and edit a nginx.configmap.yaml manifest to create a Deployment resource
- Update and edit a deployment.yaml manifest to create a ConfigMap resource
- Use the kubectl apply command to perform a deployment using the updated manifest files into the Kubernetes cluster
- Update and edit a Helm deployment.yaml template
- Update and edit a Helm values.yaml file
- Use the helm template command together with the kubectl apply command to perform a deployment using templates into the Kubernetes cluster
- Create and edit Helm environment specific value files: values.dev.yaml and values.prod.yaml
- Use the helm template command together with the kubectl apply command to perform a dev deployment into the Kubernetes cluster
- Use the helm template command together with the kubectl apply command to perform a prod deployment into the Kubernetes cluster
- Test and validate the container setup using the curl command
- Be comfortable with basic Linux command line administration
- Be comfortable with basic container concepts
This Lab will start with the following AWS resources provisioned automatically for you:
- A single EC2 instance, named ide.containers.cloudacademy.platform.instance, which will have a public IP address attached. This will be the instance that you will connect to using your local workstation browser.
To achieve the Lab end state, you will be walked through the process of:
- Using your local workstation browser to remotely connect to ide.containers.cloudacademy.platform.instance
- Using the web based IDE and integrated terminal, you'll complete the remainder of the stated Lab Objectives (above)
January 3rd, 2022 - Updated code block
December 15th, 2021 - Updated the indentation of some code blocks
August 14th, 2020 - Fixed expired certs issue preventing Kubernetes environment from starting
September 28th, 2021 - Updated to use K8s 1.22 and Helm 3
Jeremy is a Content Lead Architect and DevOps SME here at Cloud Academy where he specializes in developing DevOps technical training documentation.
He has a strong background in software engineering, and has been coding with various languages, frameworks, and systems for the past 25+ years. In recent times, Jeremy has been focused on DevOps, Cloud (AWS, Azure, GCP), Security, Kubernetes, and Machine Learning.
Jeremy holds professional certifications for AWS, Azure, GCP, Terraform, Kubernetes (CKA, CKAD, CKS).