Skip to Content
Kubernetes: Up and Running, 3rd Edition
book

Kubernetes: Up and Running, 3rd Edition

by Brendan Burns, Joe Beda, Kelsey Hightower, Lachlan Evenson
August 2022
Intermediate to advanced
328 pages
8h 22m
English
O'Reilly Media, Inc.
Book available
Content preview from Kubernetes: Up and Running, 3rd Edition

Chapter 13. ConfigMaps and Secrets

It’s good practice to make container images as reusable as possible. The same image should be able to be used for development, staging, and production. It’s even better if the same image is general-purpose enough to be used across applications and services. Testing and versioning are more risky and complicated if images need to be re-created for each new environment. How then do we specialize the use of that image at runtime?

This is where ConfigMaps and Secrets come into play. ConfigMaps are used to provide configuration information for workloads. This can be either fine-grained information like a string or a composite value in the form of a file. Secrets are similar to ConfigMaps but focus on making sensitive information available to the workload. They can be used for things like credentials or TLS certificates.

ConfigMaps

One way to think of a ConfigMap is as a Kubernetes object that defines a small filesystem. Another way is as a set of variables that can be used when defining the environment or command line for your containers. The key thing to note is that the ConfigMap is combined with the Pod right before it is run. This means that the container image and the Pod definition can be reused by many workloads just by changing the ConfigMap that is used.

Creating ConfigMaps

Let’s jump right in and create a ConfigMap. Like many objects in Kubernetes, you can create these in an immediate, imperative way, or you can create them from a manifest ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Terraform: Up and Running, 3rd Edition

Terraform: Up and Running, 3rd Edition

Yevgeniy Brikman
Docker: Up & Running, 3rd Edition

Docker: Up & Running, 3rd Edition

Sean P. Kane, Karl Matthias
Ansible: Up and Running, 3rd Edition

Ansible: Up and Running, 3rd Edition

Bas Meijer, Lorin Hochstein, René Moser

Publisher Resources

ISBN: 9781098110192Errata PageSupplemental Content