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.

Creating ConfigMaps from Directories

Chapter 11 ■ Using ConfigMaps

In this section we shall create a ConfigMap from files in a directory. First, create a directory /mysql/env and

set the directory’s permissions to global (777):

sudo mkdir /mysql/env

sudo chmod -R 777 /mysql/env

The /mysql/env directory is created as shown in Figure 11-2. CD (change directory) to the /mysql/env

directory.

Figure 11-2. Creating the /mysql/env directory

Create five files, each with a file name that would form the key for a configuration property in the

ConfigMap as listed in Table 11-2.

Table 11-2. ConfigMap Fields

File name

mysql.root.password

mysql.user

mysql.password

mysql.allow.empty.password

mysql.database

File content

mysql

mysql

mysql

no

mysql

Use the vi editor to create each of the files; for example:

sudo vi mysql.root.password

Specify the value that is to be used as the root password and save the file with :wq as shown in Figure 11-3.

Figure 11-3. File mysql.root.password

Similarly, the value stored in the mysql.allow.empty.password would be no as shown in Figure 11-4.

259

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

Saved successfully!

Ooh no, something went wrong!