Configuration as Code (CaC): Helms

Configuration as Code in the Cloud Stack


Helm Fundamentals

What Helm does?
Helm as a Packaging System
Key objects of a Chart
Release lifecycle

Nginx Chart Components

Chart: Bitnami Secure Images Helm chart for NGINX Open Source

Chart.yaml

The Helm manifest defining the chart (identity, version, dependencies, and metadata)

annotations
1
2
3
4
5
6
7
8
9
10
annotations:
  images: |
    - name: git
      image: docker.io/bitnami/git:2.51.0-debian-12-r0
    - name: nginx
      image: docker.io/bitnami/nginx:1.29.1-debian-12-r0
    - name: nginx-exporter
      image: docker.io/bitnami/nginx-exporter:1.4.2-debian-12-r9
  licenses: Apache-2.0
  tanzuCategory: clusterUtility
apiVersion
1
apiVersion: v2
appVersion
1
appVersion: 1.29.1
dependencies
1
2
3
4
5
6
dependencies:
- name: common
  repository: oci://registry-1.docker.io/bitnamicharts
  tags:
  - bitnami-common
  version: 2.x.x
templates/
Rendering final manifests from templates
1
helm template my-nginx oci://registry-1.docker.io/bitnamicharts/nginx
Portion of templates/deployment.yaml
1
2
3
4
5
6
7
8
apiVersion: 
kind: Deployment
metadata:
  name: 
  namespace: 
  labels:
  annotations:
values.yaml
values.schema.json

Hands-on

Details

Helm is already installed in CloudLab’s class profile. The installation script is located in install_helm.sh. This script needs to be run as root.

Check Helm version
1
helm version
Deploy Nginx from Helm as-is
1
2
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
1
kubectl create namespace web
1
2
3
4
mkdir my-nginx
cd my-nginx
helm template my-nginx bitnami/nginx -n web > nginx-template.yaml
cat nginx-template.yaml
1
helm install my-nginx bitnami/nginx -n web
1
helm status my-nginx -n web
1
2
kubectl get pods -n web
kubectl get svc -n web
1
helm uninstall my-nginx -n web
Deploy customed Nginx from Helm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
image:
  registry: docker.io
  repository: nginx
  tag: "1.25.5"
  pullPolicy: IfNotPresent

containerPorts:
  http: 80

service:
  type: NodePort
  ports:
    http: 8080        # Service port inside cluster (arbitrary)
  nodePorts:
    http: 32080       # External NodePort (within default range)

containerSecurityContext:
  enabled: true
  runAsNonRoot: false
  runAsUser: 0
1
helm template my-nginx bitnami/nginx -n web -f my-values.yaml > nginx-rendered.yaml
1
diff nginx-template.yaml nginx-rendered.yaml
1
helm install my-nginx bitnami/nginx -n web -f my-values.yaml
1
kubectl get svc my-nginx -n web