Member-only story
Lab3 (Spring Boot/K8S): Mastering ConfigMaps in Kubernetes
Hello Devs! Welcome back to our series of stories with Kubernetes and Spring ecosystem. In this story, we’ll learn how to use ConfigMaps in Kubernetes.

· Overview
∘ What are Kubernetes ConfigMaps?
∘ Where are ConfigMaps stored in Kubernetes?
∘ ConfigMap object
· How to use a ConfigMap to configure a container inside a Pod
∘ 1. Environment variables for a container
∘ 2. Injecting a ConfigMap entry as a command-line argument
∘ 3. Mounting ConfigMaps into Pods as volumes
∘ 4. Using Immutable ConfigMaps
· Conclusion
· References
This series of stories shows how to use Kubernetes in the Spring ecosystem. We work with a Spring boot API and Minikube to have a lightweight and fast development environment similar to production.
- Lab1 (Spring Boot/K8S): Deploy Spring Boot application on Kubernetes
- Lab2 (Spring Boot/K8S): Kubernetes health probes with Spring Boot
- 👉 Lab3 (Spring Boot/K8S): Mastering ConfigMaps in Kubernetes
In the previous lab (lab 2), we saw how to use Spring’s Actuator to improve our application’s health monitoring with Kubernetes. In this story, we’ll learn how to configure the spring boot application on Kubernetes to use ConfigMaps.
Overview
What are Kubernetes ConfigMaps?
A Kubernetes ConfigMap is an API object used to store non-confidential data in key-value pairs. A ConfigMap is not designed to hold large chunks of data. The data stored in a ConfigMap cannot exceed 1 MiB. If you need to store settings that are larger than this limit, you may want to consider mounting a volume or using a separate database or file service.
Caution: ConfigMap does not provide secrecy or encryption. If the data you want to store are confidential, use a Secret rather than a ConfigMap, or use additional (third party) tools to keep your data private.