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

Creating ConfigMaps from Files

Next, we shall create a ConfigMap using only some of the files in the /mysql/env directory. Only the

MYSQL_ROOT_PASSWORD environment variable is mandatory. As an example, create a ConfigMap called mysqlconfig-2

from the mysql.allow.empty.password and mysql.root.password files.

/kubectl create configmap mysql-config-2 --from-file=/mysql/env/mysql.root.password --fromfile=/mysql/env/mysql.allow.empty.password

The mysql-config-2 ConfigMap is created as shown in Figure 11-12. Next, describe the ConfigMap. The

two key/value pairs are listed. The ConfigMap may also be listed as a YAML.

Figure 11-12. Creating ConfigMap from files

Next, consume the ConfigMap in a replication controller definition file mysql.yaml.

266

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

Saved successfully!

Ooh no, something went wrong!