Checking out the container-native application development inner loop
Kubernetes and containers have introduced a new set of challenges and complexities to the inner development loop. Now there are an additional set of steps added to the inner loop while developing applications, which is time-consuming. A developer would prefer to spend time solving business problems rather than waiting for the build process to complete.
It involves steps such as the following:
- A developer making code changes in an IDE
- Building and packaging the application
- Creating a container image
- Pushing the image to a container registry
- Kubernetes pulling the image from the registry
- Kubernetes creating and deploying the pod
- Finally, testing and repeating
Engineers at Google call this an infinite loop of pain and suffering. Here is a visualization of the container-native application development inner loop:
As you can see, we now have three more steps added to the inner development loop, that is, creating a container image of your application, pushing it to a container registry, and finally, pulling the image while deploying to a container orchestration tool such as Kubernetes.
The container image could be a Docker or OCI format image, depending on the tool you use to build your images. You have options such as Docker Hub, AWS Container Registry, Google Container Registry, or Azure Container Registry for the container registry. Then, finally, in deployment, for your container orchestration, you have tools such as Kubernetes, which will first pull the image from the container registry and deploy your application.
There are many manual steps involved here. It also depends on what tools you have used for the local development workflow. For instance, you will use commands such as the following:
docker build docker tag docker push kubectl apply
The following are the detailed steps that a developer has to go through while developing container-native applications:
- Defining how to configure the OS for your container with a Dockerfile
- Defining the packaging of your application into a container image by adding instructions to the Dockerfile
- Creating a container image with Docker commands such as
docker build
anddocker tag
- Uploading the container image to a container registry with a command such as
docker push
- Writing one or more Kubernetes resource files in YAML
- Deploying your application to the cluster with commands such as
kubectl apply -f myapp.yaml
- Deploying services to the cluster with commands such as
kubectl apply -f mysvc.yaml
- Writing the config so that apps can work together with commands such as
kubectl create configmap
- Configuring apps to work together correctly with commands such as
kubectl apply -f myappconfigmap.yaml
Wooh!!! That's a lot of steps and a time-consuming process. You can use scripting or docker compose
to automate it to some extent, but soon you will realize that it cannot be fully automated without a tool such as Skaffold, which can abstract away many things related to building and deployment.
In Chapter 3, Skaffold – Easy-Peasy Cloud-Native Kubernetes Application Development, we will cover Skaffold, which simplifies the process we have covered here with a single command. My only intention here was to give you an idea of the steps involved. We will cover these steps with some hands-on examples in the next chapter.