Managing application configuration using ConfigMaps and Secrets

To provide configuration for an application running on Kubernetes, there are a couple of possible approaches, documented in https://kubernetes.io/docs/tasks/inject-data-application/:

  • Passing arguments to the container commands
  • Defining system environment variables for the container
  • Mounting ConfigMaps or Secrets as container volumes
  • Optionally wrapping everything up using PodPresets

This section will focus on using ConfigMaps and Secrets, which are, in many aspects, similar but have very different purposes.

First, let's take a look at Secrets. In almost every application, you will have to manage sensitive information for accessing dependencies, such as passwords, OAuth tokens, ...

Get Hands-On Kubernetes on Windows now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.