Course contentsShow
← Docker, Kubernetes & CI/CD
Lesson 447 of 8027. Package Management and AutomationFree lesson

Managing Application Configurations with Values Files

Learners will externalize environment-specific configurations into separate values files to enable flexible deployments across development, staging, and production environments.

In this lesson, you will learn how to decouple your application's logic from its environmental settings by leveraging Helm values.yaml files to support consistent deployments across development, staging, and production.

The Problem of Hardcoding

When you define your Kubernetes manifests directly within a Helm chart, you often face a dilemma: how do you change parameters like replica counts, database endpoints, or resource limits without modifying the chart templates themselves? If you hardcode these values, you lose the ability to promote the exact same application package through different lifecycle stages.

Externalizing Configurations

The values.yaml file acts as the "configuration layer" for your chart. Instead of hardcoding values in your template files, you use the {{ .Values.key }} syntax. This allows you to keep your core chart logic static while injecting environment-specific variables at runtime.

For example, in your deployment.yaml template:

replicas: {{ .Values.replicaCount }}
resources:
  limits:
    cpu: {{ .Values.resources.cpu }}

Supporting Multiple Environments

To manage different environments, you don't need multiple versions of your chart. Instead, you create environment-specific files—such as values-dev.yaml, values-staging.yaml, and values-prod.yaml.

When you deploy, you instruct Helm to merge these files with your base chart:

# Deploying to production
helm install my-app ./my-chart -f values-prod.yaml

# Deploying to development with an override
helm install my-app ./my-chart -f values-dev.yaml --set replicaCount=1

By externalizing these configurations, your team can maintain a single, "source of truth" chart that remains identical across your CI/CD pipeline. The differences are confined to small, environment-specific YAML files that define how the application should behave in each context—whether that means scaling up instances for production or lowering memory limits to save costs in a development cluster. This separation ensures that your deployment process is predictable, repeatable, and easier to debug.

Key Takeaway: By using separate values files to override template defaults, you decouple your application’s architecture from its operational requirements, enabling portable and environment-aware deployments.