Feedback

Chat Icon

Cloud-Native Microservices With Kubernetes - 2nd Edition

A Comprehensive Guide to Building, Scaling, Deploying, Observing, and Managing Highly-Available Microservices in Kubernetes

From Settings to Startup: Managing Configuration and Initialization in Kubernetes
33%

ConfigMap: Setting Non-Sensitive Configurations

We already know that ConfigMaps are used to store non-sensitive configuration data in key-value pairs. Here is a simple ConfigMap that sets the SIGNING_ALGO variable to sha256:

apiVersion: v1
kind: ConfigMap
metadata:
  name: hmac-config
  namespace: hmac
data:
  SIGNING_ALGO: "sha256"

In this example, we have a single key-value pair, but what if we have multiple key-value pairs? Usually, ConfigMaps are created from files. Imagine you have an application that is configured using a file called .env that contains tens of key-value pairs like this:

VAR_1=value_1
VAR_2=value_2
VAR_3=value_3
..
VAR_N=value_N

Cloud-Native Microservices With Kubernetes - 2nd Edition

A Comprehensive Guide to Building, Scaling, Deploying, Observing, and Managing Highly-Available Microservices in Kubernetes

Enroll now to unlock all content and receive all future updates for free.