Skip to content

Latest commit

 

History

History
212 lines (142 loc) · 4.32 KB

File metadata and controls

212 lines (142 loc) · 4.32 KB

📦 Packaging & Deploying Applications with Helm Charts

📘 See concepts/HelmVsKustomize.md for how Helm compares to Kustomize and when to reach for each.

Step 1: Cluster Setup

Cluster Configuration: kind-config.yaml

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
  - role: control-plane
    extraPortMappings:
      - containerPort: 80   # for nginx ingress
        hostPort: 80
        protocol: TCP
      - containerPort: 30080 # for gateway api
        hostPort: 30080
        protocol: TCP
  • Run the following command to create a Kubernetes cluster using the provided kind-config.yaml:

    kind create cluster --config kind-config.yaml
  • Create mern-devops namespace:

    kubectl create namespace mern-devops

Step 2: Install Envoy Gateway Controller with Gateway API CRDs

helm install eg oci://docker.io/envoyproxy/gateway-helm --version v0.0.0-latest -n envoy-gateway-system --create-namespace

Wait for Envoy Gateway to become available:

kubectl wait --timeout=5m -n envoy-gateway-system deployment/envoy-gateway --for=condition=Available

Step 3: Install the Helm Chart

helm install mern-devops ./helm-chart

Step 4: Verify

List Helm releases:

helm ls

helm-install

Check the status of all resources:

kubectl get all -n mern-devops

helm-get-all

Verify Gateway API Resources

kubectl get gatewayclass
kubectl get gateway -n mern-devops
kubectl get httproute -n mern-devops

gateway-api-resources

⚠️ Important: If running locally, the gateway status will show Programmed: False since kind has no LoadBalancer support. The NodePort patch in the next step resolves this for local access.

Verify Envoy Gateway Resources

kubectl get pods -n envoy-gateway-system
kubectl get svc -n envoy-gateway-system

Access the Application

🔧 Local Testing Only: Patch the envoy gateway service to NodePort for local access. Not needed in production (use LoadBalancer or proper DNS).

Get the envoy gateway service name:

kubectl get svc -n envoy-gateway-system
# Look for the service named: mern-devops-envoy-gateway-<hash>

Patch it to NodePort:

kubectl patch svc <service-name> -n envoy-gateway-system \
  -p '{"spec":{"type":"NodePort","ports":[{"port":80,"nodePort":30080,"protocol":"TCP"}]}}'

envoy-mern-devops-gateway-patch

Access the application at:

http://localhost:30080

gateway-api-webapp

Step 5: Cleanup

helm uninstall mern-devops

Confirm removal:

helm ls
kubectl get ns

(Optional) Publish Helm Chart to GHCR (OCI)

This project supports publishing and consuming the Helm chart using GitHub Container Registry (GHCR) as an OCI registry.


1) Login to GHCR

export GHCR_USERNAME="atkaridarshan04"
export GHCR_TOKEN="<your_github_token>"

echo $GHCR_TOKEN | helm registry login ghcr.io -u $GHCR_USERNAME --password-stdin

2) Package the Helm Chart

Run this inside the chart directory (where Chart.yaml exists):

helm package .

This generates a versioned chart archive like:

mern-chart-2.0.0.tgz

3) Push the Chart to GHCR

helm push mern-chart-2.0.0.tgz oci://ghcr.io/atkaridarshan04/helm-charts

This will publish the chart as:

ghcr.io/atkaridarshan04/helm-charts/mern-charts:2.0.0

4) Pull the Chart from GHCR

helm pull oci://ghcr.io/atkaridarshan04/helm-charts/mern-chart --version 2.0.0

(Optional) Extract it:

helm pull oci://ghcr.io/atkaridarshan04/helm-charts/mern-chart --version 2.0.0 --untar

5) Install the Chart from GHCR

helm install mern-devops oci://ghcr.io/atkaridarshan04/helm-charts/mern-chart --version 2.0.0

6) Upgrade an Existing Release

helm upgrade mern-devops oci://ghcr.io/atkaridarshan04/helm-charts/mern-chart --version 2.0.0

7) Show Chart Metadata (Verify Version)

helm show chart oci://ghcr.io/atkaridarshan04/helm-charts/mern-chart --version 2.0.0