Dynamic configuration without rebuild¶
Dynamic configuration without rebuild is a DevOps capability that allows applications to adjust their behavior or connection parameters without requiring a new container image build or deployment cycle^[400-devops-06-kubernetes-k8s-paas-06k8sapollo.md]. This is achieved by decoupling configuration from application code using a configuration center^[400-devops-06-kubernetes-k8s-paas-06k8sapollo.md].
Core Principles¶
This methodology adheres to the "Ops Eight Honors and Eight Shames" (运维八荣八耻), specifically prioritizing configuration over hard-coding^[400-devops-06-kubernetes-k8s-paas-06k8sapollo.md].
- Centralized Management: Configuration is managed centrally in a "Configuration Center" (配置中心), allowing for unified control over application settings^[400-devops-06-kubernetes-k8s-paas-06k8sapollo.md].
- Decoupling: ConfigMaps can be used to decouple configuration files from container images, improving portability and reusability^[400-devops-06-kubernetes-k8s-paas-06k8sapollo.md].
- Environment Isolation: Different environments (e.g., Test and Prod) are managed through distinct configurations rather than different code builds, enabling a "single build, multi-environment" delivery model^[400-devops-06-kubernetes-k8s-paas-06k8sapollo.md].
Implementation¶
A common implementation involves integrating a system like [[Apollo]] into a Kubernetes cluster^[400-devops-06-kubernetes-k8s-paas-06k8sapollo.md]. In this setup, applications connect to the configuration service via a meta-server address (e.g., http://config.od.com), enabling them to pull or receive updated configuration dynamically^[400-devops-06-kubernetes-k8s-paas-06k8sapollo.md].
For example, a Dubbo service's registry address or port can be modified in the Apollo Portal and published; the changes take effect immediately upon the application's next configuration poll or restart, without rebuilding the Docker image^[400-devops-06-kubernetes-k8s-paas-06k8sapollo.md].
Benefits¶
- Risk Reduction: Reduces the chance of production accidents caused by mixing up test and production environment configurations during packaging^[400-devops-06-kubernetes-k8s-paas-06k8sapollo.md].
- Efficiency: Eliminates the need for repeated packaging and deployment when changing settings like connection ports or database addresses^[400-devops-06-kubernetes-k8s-paas-06k8sapollo.md].
- Auditability: Provides configuration version control and security audit features (config review)^[400-devops-06-kubernetes-k8s-paas-06k8sapollo.md].
Related Concepts¶
- [[Configuration Center]]
- [[Continuous Delivery]]
- [[Microservices]]
Sources¶
^[400-devops-06-kubernetes-k8s-paas-06k8sapollo.md]