configmap: passing parameters to achieve the container application.
The reason:
just to let image and configuration files decoupling, in order to achieve a mirror portability and reusability
for example, for example, I have a pod, it is necessary to run in a formal environment, but also to run in a test environment, as well as advance three environments, but which configuration is not the same, then we need to be prepared to test three different pod use.
configmap is to solve this problem, we only need to prepare different configmap can then mount the different configmap to the same pod which can be achieved pod run in different environments, reduce the complexity of the pod, the pod and implement procedures separation.
Configuration files I upload to the Baidu network disk:
Link: https://pan.baidu.com/s/1qypUw_jK05BC0VKOWXG6_Q
extraction code: 1m32
Let's first create a demonstration at the results:
kubectl ConfigMap the Create HTML index-the --from--o YAML File index.html> configmap.yaml
View configmap index-html content of
kubectl describe configmap index-html
Next, create the deployment and the service of documents yaml
here must write, path, and configuration files
Then start clicking
Access what look at the results
. This shows that we have mounted successful,
If you feel that simple, we will be a test mysql
First create a mysql of configmap
Then start clicking
The following is the profile contents
= ------------------------------------------------- -
Next, look at the mysql configuration
Note here that the above is the path to the configuration file mysql
The following is configmap the name we defined above
Here to correspondence
Then start the next
Is not it the same configuration as above configmap
Prior to look into the mysql password is right above
Above is today talking about configmap, it configured to mount pod of them, you have follow-up questions can leave a message private letters and comments area