k8s ConfigMap mysql configuration and use nginx (13)

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:
k8s ConfigMap mysql configuration and use nginx (13)
kubectl ConfigMap the Create HTML index-the --from--o YAML File index.html> configmap.yaml

k8s ConfigMap mysql configuration and use nginx (13)
k8s ConfigMap mysql configuration and use nginx (13)
View configmap index-html content of
kubectl describe configmap index-html
k8s ConfigMap mysql configuration and use nginx (13)


Next, create the deployment and the service of documents yaml
k8s ConfigMap mysql configuration and use nginx (13)
here must write, path, and configuration files


Then start clicking
k8s ConfigMap mysql configuration and use nginx (13)

Access what look at the results
k8s ConfigMap mysql configuration and use nginx (13)
. This shows that we have mounted successful,

If you feel that simple, we will be a test mysql

First create a mysql of configmap
k8s ConfigMap mysql configuration and use nginx (13)

Then start clicking

k8s ConfigMap mysql configuration and use nginx (13)
The following is the profile contents

= ------------------------------------------------- -
Next, look at the mysql configuration

k8s ConfigMap mysql configuration and use nginx (13)

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

k8s ConfigMap mysql configuration and use nginx (13)
Is not it the same configuration as above configmap

k8s ConfigMap mysql configuration and use nginx (13)
Prior to look into the mysql password is right above
k8s ConfigMap mysql configuration and use nginx (13)


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

Guess you like

Origin blog.51cto.com/xiaorenwutest/2485823