19.06.2021 Views

148422597X Kubernetes Management Design Patterns [Vohra 2017-01-29] {E559F6BB}

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 11 ■ Using ConfigMaps

Consuming a ConfigMap in a Volume

In this section we shall create a ConfigMap to store a certificate key-value pair and consume the ConfigMap

in a volume. Create a definition file cert.yaml for a ConfigMap in which to specify the certificate.

apiVersion: v1

kind: ConfigMap

metadata:

name: nginx-cert

data:

cert.pem: |-

-----BEGIN CERTIFICATE-----

abc

-----END CERTIFICATE-----

privkey.pem: |-

-----BEGIN PRIVATE KEY-----

abc

-----END PRIVATE KEY-----

The ConfigMap definition file is shown in the vi editor in Figure 11-20.

Figure 11-20. ConfigMap to store a certificate key-value pair

Create a ConfigMap from the definition file as shown in Figure 11-21.

./kubectl create -f cert.yaml

Describe the ConfigMap to list the two key/value pairs as shown in Figure 11-21.

274

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!