305-998-7702 | 415-800-2922 info@rx-m.com

Cloud Native Short Take – Kubernetes Application Configuration

(Oct. 19, 2021) – Welcome to the latest RX-M Cloud Native Short Take; we’re reviewing the RX-M…

(Oct. 19, 2021) – Welcome to the latest RX-M Cloud Native Short Take; we’re reviewing the RX-M Kubernetes Application Configuration module. 

In this module, we configure our applications to run on Kubernetes. First, we discuss how common configuration paradigms are implemented at Kubernetes. We’ll also discuss the concept of spec portability. We’ll then take a look at how to create and consume secrets and ConfigMap resources in Kubernetes, and then lastly, we also demonstrate the use of the downward API. 

In this short take demo, we look at how we can realize the concept of portability in Kubernetes by deploying one pod spec across multiple namespaces and observing different behavior from that pod in each namespace to which it’s been deployed.

My Kubernetes demo cluster has two additional namespaces: dev and test. 

I prepared a pod specification for my application that I would like to deploy to both namespaces.

The pod runs a busybox container that outputs the value of an environment variable called message. The message environment variable’s value will be populated from a ConfigMap, including the key: message.

The ConfigMap can have the same name between each namespace, enabling the application to show different behavior based on where it’s deployed. For example, in the dev namespace, I create the ConfigMap with the value of the message set to hello. Then, In the test namespace, I create the same ConfigMap but change the value to bonjour.

After I apply the pod spec in the dev namespace, it outputs hello per the ConfigMap in the same namespace. When deployed in the test namespace to see, it outputs bonjour.

ConfigMaps and a pod spec that pull values from a ConfigMap are just one way to achieve application portability in Kubernetes. This works for simple key-value pairs or more complex config files. Since these are just Kubernetes primitives, your portable application deployments can deploy in one cluster or another cluster or namespaces within the cluster and behave differently based on requirements in each environment. 

This module is just a sample of what you could learn in the Kubernetes Application Configuration module. 

You can create your own customized Kubernetes course with this and many other modules using the courseware builder on RX-M.com. First, navigate to RX-M.com, and under courses, click the custom course builder. Next, scroll down and select the preferred module from the list and drag it over to your custom course.

That’s the Cloud Native short take on the Kubernetes Application Configuration Module.