0
0
Kubernetesdevops~30 mins

Chart values and customization in Kubernetes - Mini Project: Build & Apply

Choose your learning style9 modes available
Chart values and customization
📖 Scenario: You are deploying a simple web application using Helm charts on Kubernetes. You want to customize the deployment by changing the number of replicas and the container image version using the chart's values.yaml file.
🎯 Goal: Learn how to set up a values.yaml file with specific values and customize a Helm chart deployment by overriding default values.
📋 What You'll Learn
Create a values.yaml file with specific values
Add a variable for the number of replicas
Use the variable in the deployment template
Print the final rendered Kubernetes deployment manifest
💡 Why This Matters
🌍 Real World
Helm charts are widely used to package and deploy applications on Kubernetes clusters. Customizing chart values allows teams to deploy the same application with different settings easily.
💼 Career
Understanding how to customize Helm charts is essential for Kubernetes administrators and DevOps engineers to manage scalable and configurable deployments.
Progress0 / 4 steps
1
Create the initial values.yaml file
Create a values.yaml file with the following exact content:
replicaCount: 2
image:
repository: nginx
tag: 1.19.0
Kubernetes
Need a hint?

The values.yaml file defines default values for your Helm chart. Use proper indentation for nested keys.

2
Add a variable for replicas in the deployment template
In the deployment template file deployment.yaml, add the line replicas: {{ .Values.replicaCount }} under the spec: section to use the replicaCount value from values.yaml.
Kubernetes
Need a hint?

Use Helm template syntax {{ .Values.replicaCount }} to access the value from values.yaml.

3
Use image repository and tag variables in the container spec
Modify the container image line in deployment.yaml to use the repository and tag from values.yaml with this exact syntax:
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
Kubernetes
Need a hint?

Use Helm template variables to dynamically set the container image from values.yaml.

4
Render and print the final Kubernetes deployment manifest
Run the Helm template command to render the deployment manifest using the values.yaml file and print the output exactly as shown:
helm template my-nginx . -f values.yaml
Kubernetes
Need a hint?

Use the helm template command with the -f values.yaml option to apply your custom values and see the final manifest.