Kubernetes learning (eight)

For eight memory of ConfigMap

1, a description

ConfigMap function Kubernetes1.2 version was introduced, many of the application from the configuration file, the command-line arguments or environment variable to read configuration information . ConfigMap API provides us injection mechanism configuration information to the vessel, may be used to hold The ConfigMap single attribute may be used to save the entire configuration file or JSON blob.

(1) Create a directory configmap

game-config: configmap name

--from-file: specify a directory, all the content will be in the directory is created. In the form of key-value pairs

-From-file all the documents specified in the directory will be used in ConfigMap which create a key-value pair, the key is the name of the file name, file content is the value of

kubectl get cm View configmap file

kubectl get cm game-config -o yaml view details

kubectl describe cm

kubectl describe configmap game-config

(2) the use of file creation configmap

Just specify ConfigMap you can create a single file from a file

--from-file This parameter can be used multiple times, you can use two configuration files to specify the two previous instances, respectively, just specify the effect is the same as the entire directory

 

 (3) using the literal creation configmap

Created using literal values ​​Lee --from-literal argument passing configuration information, the parameter may be used several times, the following format

2, Pod use configmap

1. configmap profile instead of

 

 Pod then filtered log

 

 By using the data volume plug configmap

3, configmap hot update

 

 Modify ConfigMap

kubectl edit configmap log-config

 

 And so you will see

 

Guess you like

Origin www.cnblogs.com/lovedairan/p/12327668.html