19.06.2021 Views

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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 11 ■ Using ConfigMaps

Create a pod definition file hello-world.yaml to consume the ConfigMap hello-world. The pod is

based on the Ubuntu Docker image and runs a /bin/echo command with the two configuration properties

in the ConfigMap as arguments.

---

apiVersion: v1

kind: Pod

metadata:

labels:

app: helloApp

name: hello-world

spec:

containers:

-

args:

- " $(MESSAGE1)"

- " $(MESSAGE2)"

command:

- /bin/echo

env:

-

name: MESSAGE1

valueFrom:

configMapKeyRef:

key: message1

name: hello-config

-

name: MESSAGE2

valueFrom:

configMapKeyRef:

key: message2

name: hello-config

image: ubuntu

name: hello

The pod definition file hello.yaml is shown in the vi editor in Figure 11-17.

271

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

Saved successfully!

Ooh no, something went wrong!