Establishing GitOps practices

Up til this point in the course, our exploration of GitOps has focused on its usage and principles. Within the exercises, a fully containerized application and cluster were provided to demonstrate the experience of working with the operating model. Now, we'll take a step back and learn how that GitOps operational model was created, starting with just the sample Python application.

Before we can manage the sample application with GitOps tools like Flux, we'll need to put in place the prerequisite container technologies that it requires. This mean's we'll need to make the following changes to the system's architecture:

  1. Create a container image that contains the sample Python application.

  2. Store the container image within a container registry.

  3. Provision a Kubernetes cluster where the container will be deployed and run.

Building a container

Before application workloads can be managed with GitOps, they must first be packaged into a container that can run on Kubernetes. Creating a container image for an application is the first step toward achieving this goal. Docker is a container platform that developers use most often when creating container images. In this lesson, we'll see how to create a container image and run it on Docker.

Writing a Dockerfile

To create a container image with Docker, developers must write a Dockerfile. A Dockerfile defines the instructions that Docker uses to build a container image. Within the interactive widget, we'll find a Dockerfile within the /usercode/system/app directory. Within the Dockerfile, we'll place a number of instructions that provide the contents of the container and the configuration it requires to run the application. A high-level overview of the instructions is as follows:

Get hands-on with 1200+ tech skills courses.