Kubernetes Configmap Detailed

Source: Internet
Author: User


Configmap Description of Kubernetes


In this blog post, let's say a question about customizing the configuration in the pod of kubernetes.



We know that in almost all application development, configuration file changes are involved, such as in the Web program, the need to connect to the database, cache, and even queues. And one of our applications starts with writing the first line of code, going through the development environment, the test environment, the pre-release environment only to the final online environment. Each environment is defined by its own set of configurations. If we do not manage these configuration files well, your operations will suddenly become extremely cumbersome. For this, some of the industry's major companies have developed their own set of configuration management center, such as Qcon, Baidu's disconf and so on. Kubernetes also offers its own set of options, namely Configmap. Kubernetes uses Configmap to implement configuration management for applications in containers.



Create Configmap



There are 4 ways to create Configmap:


  • Created by specifying the CONFIGMAP parameter directly on the command line, i.e.--from-literal

  • Create a configuration file as a configmap by specifying the file creation--from-file=<文件>

  • By specifying the directory creation, all profiles under a directory are created as a configmap,--from-file=<目录>
    Created by the Yaml file, and the other by Kubectl directly at the command line.

  • Write the standard configmap Yaml file in advance, and then Kubectl create-f create






Using Configmap


There are three ways to use Configmap, one is to pass the pod directly through the environment variable, the other is to run it through the command line of the pod, and the third is to mount it in the pod using volume.



After updating Configmap:


    • ENV mounted using this configmap will not synchronize updates

    • The data in the Volume mounted with the Configmap takes a while (measured approximately 10 seconds) to synchronize updates


ENV is injected when the container is started, kubernetes will not change the value of the environment variable after startup, and the environment variable of pod in the same namespace is constantly accumulating, refer to The service discovery in Kubernetes and the environment variable transfer between Docker containers is explored. In order to update the configuration using Configmap mounts in the container, you can force the Configmap to be re-mounted by rolling the pod update, or you can set the number of replicas to 0 before you update the CONFIGMAP, and then expand the capacity.



Configmap Description of Kubernetes



Reference https://www.cnblogs.com/breezey/p/6582082.html



Kubernetes configmap Thermal Update test



Https://www.kubernetes.org.cn/3138.html



Kubernetes's Configmap explanation



Reference 79492374






Kubernetes Configmap Detailed


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.