Skip to main content

Lab 10.2 - Customization with values.yaml

Lab Objectives

By the end of this lab, you will be able to:

  • Understand the values.yaml file.
  • Customize a Chart with custom values.
  • Use --set and --values.
  • View a Chart's default values.

Estimated Duration

45-60 minutes

Prerequisites

  • Helm installed and configured.
  • Local Kubernetes cluster running.
  • Knowledge of Helm Charts (Chapter 10.2).

Part 1: Examining Default Values

Step 1.1: View a Chart's Values

Examine the default values of the NGINX Chart:

helm show values bitnami/nginx > nginx-default-values.yaml
cat nginx-default-values.yaml

Part 2: Customization with --set

Step 2.1: Install with --set

Install NGINX with custom values:

helm install my-nginx-custom bitnami/nginx \
--set service.type=NodePort \
--set service.nodePorts.http=30080 \
--set replicaCount=3

Verify:

kubectl get svc my-nginx-custom
kubectl get deployment my-nginx-custom

Part 3: Customization with values.yaml

Step 3.1: Create a values.yaml File

Create my-nginx-values.yaml:

replicaCount: 2

service:
type: LoadBalancer
port: 80

resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 200m
memory: 256Mi

Step 3.2: Install with --values

Install with the values file:

helm install my-nginx-values bitnami/nginx -f my-nginx-values.yaml

Verify the applied values:

helm get values my-nginx-values

Part 4: Combining --set and --values

You can combine both:

helm install my-nginx-combined bitnami/nginx \
-f my-nginx-values.yaml \
--set replicaCount=4

Values from --set take priority over the file.


Part 5: Updating with New Values

Step 5.1: Modify the Values

Modify my-nginx-values.yaml:

replicaCount: 5

Step 5.2: Update the Release

helm upgrade my-nginx-values bitnami/nginx -f my-nginx-values.yaml

Verify:

kubectl get deployment my-nginx-values

Part 6: Cleanup

helm uninstall my-nginx-custom my-nginx-values my-nginx-combined

Lab Summary

In this lab, you customized Helm Charts with values.yaml files and --set options. You learned how to examine default values and apply your own configurations.


Next Steps

The next lab will show you how to create your own Helm Chart.

Lab 10.3: Creating a Custom Chart


Lab created on: December 2024