Configuration management and automation in Kubernetes | by Global Technology | McDonald’s Technical Blog | Feb, 2024

Configuration management and automation in Kubernetes | by Global Technology | McDonald’s Technical Blog | Feb, 2024

When developers need to move with speed and scale, configuration management and automation delivers.

by Unnathi VallapuReddy, Software Engineer III

As a brand leader with unique global reach, McDonald’s ability to manage and deploy applications at scale is business critical. At McDonald’s, we use Kubernetes to facilitate the efficient orchestration of applications across diverse markets.

In our experience, the challenge of handling configuration data in a containerized environment is particularly pronounced when dealing with multiple environments in multiple markets. McDonald’s leverages ConfigMaps, a feature within Kubernetes, to streamline the management of configuration settings, addressing complexities of deploying and maintaining applications at scale in a global context.

What are ConfigMaps?
ConfigMaps are designed to separate configuration artifacts from containerized applications. We use this feature to segregate non-sensitive configuration data from application code, facilitating a streamlined approach to the management, updates, and distribution of configuration settings across multiple pods. Notably, we look to the ConfigMaps capability to provision the configuration properties files as a volume to pods, enhancing the efficiency of configuration management within Kubernetes deployments.

Use cases

Application configuration: ConfigMaps are used to store the non-sensitive application configuration. This encompasses API calls, database strings, and any additional parameters, including environment variables that may vary across different environments, such as development, testing, and production and different markets.

Environment-specific configuration: Based on my experience, I suggest strategically segregating configuration code from application code, which has helped us in many ways, and we follow that as a best practice.

Having an environment-specific configuration for each environment provides the capability to modify application configurations without redeployment of application code. This not only may help enhance flexibility and ease of maintenance, but also may help streamline the deployment process, allowing for efficient and targeted updates. Often, we must change the configuration of the application based on the environment. For example, connection string of a database, bootstrap servers of an event streaming platform, or a specific topic name, and we do not want to redeploy the entire application.

This is where we found ConfigMaps may be leveraged. We can create a ConfigMap for each environment and then mount it as a volume to the pod. This allows us to change the configuration without redeploying the entire application, which is helpful when we want to just update a single parameter in the configuration file for a specific environment. This helps ensure the change is scoped to that environment without affecting other environments.

McDonald’s uses ConfigMaps to store delivery service–provider specific configurations and rules, based on the market in which the application is deployed, and the delivery service provider is operating. For example, the same delivery service provider configuration for the U.S. market could be different from the same delivery service provider configuration for a different market. ConfigMaps may be leveraged to manage these configurations across multiple markets.

How are we using ConfigMaps at McDonald’s?
We have a predefined set of configurations specified to each delivery service provider based on the market.

The application code and configuration need to be able to keep up with the changing business requirements, while allowing time to bring the changes to market with the least disruption to business operations. These requirements may only require a change to a part of the configuration and not application code.

Without ConfigMaps, we would need to redeploy the entire application stack, which could possibly create multiple issues, if overlooked. By using ConfigMaps to externalize the configuration artifacts, these changes would be less intrusive and would only be scoped to the configuration change, which may help reduce the chance of introducing new issues.

How to apply ConfigMaps (CI/CD pipeline)
When a configuration changes, all we do is push the new configuration to version control, and automated CI pipelines will pick up the changes, which has Kubectl commands to apply the new configuration, redeploying the ConfigMaps. Once it is available in the ConfigMap, all pods can pull the new changes.

The Configmap.yaml file could have the following content in it:

Advantages of using ConfigMaps

  • Decoupling configuration from code: We use ConfigMaps to help separate configuration settings from application code, promoting a modular and clean architecture. The division facilitates the independent management and updating of configurations decoupled from the intricacies of the application logic.
  • Environment consistency: We centralize configuration settings with ConfigMaps enabling us to maintain consistency across different environments.
  • Scalability: As your application expands in scale, the manual management of configuration settings can become cumbersome. For us, ConfigMaps is a centralized and scalable solution for handling configuration data, which helps to simplify the horizontal scaling of applications.
  • Dynamic updates: ConfigMaps facilitate dynamic updates, enabling real-time modifications to configuration settings without the need for a complete application redeployment.
  • Pod portability: To pod portability, we leverage ConfigMaps to enable the mounting of configuration data as volumes. This allows for a singular application container to operate with varied configurations, achieved by mounting the corresponding ConfigMap.
  • Integration with continuous delivery: To enable automated updates and configurations in the deployment process, McDonald’s integrates ConfigMaps with continuous delivery pipelines.
  • Developer productivity: Configuration can be updated by using a CI/CD pipeline and this would be available to all pods in the cluster.

ConfigMaps can be helpful in in managing the configuration settings of various delivery service providers, as well as the service providers across varied global markets without manually maintaining these configurations. At McDonald’s, ConfigMaps support deployment velocity and dynamic configuration management without having to redeploy the entire stack.


No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *