DEV Community

ANKUSH CHOUDHARY JOHAL
ANKUSH CHOUDHARY JOHAL

Posted on • Originally published at johal.in

Revolutionize serverless OpenShift deep dive Helm 4: A Practical Guide

Revolutionize Serverless OpenShift: A Helm 4 Deep Dive Practical Guide

Serverless computing on Red Hat OpenShift has transformed how teams deploy event-driven, scalable workloads without managing underlying infrastructure. With the release of Helm 4, the package manager for Kubernetes has introduced critical updates tailored for serverless workflows, enabling faster, more reliable, and cost-effective deployments. This guide walks through practical steps to leverage Helm 4 for serverless OpenShift, from setup to advanced production patterns.

Prerequisites

Before getting started, ensure you have the following:

  • A running Red Hat OpenShift 4.12+ cluster with cluster-admin privileges
  • OpenShift CLI (oc) v4.12+ installed and authenticated to your cluster
  • Helm 4.0+ installed locally (verify with helm version --short)
  • OpenShift Serverless Operator and Knative Serving installed on your cluster
  • A container registry (e.g., Quay.io, OpenShift Internal Registry) for storing container images

Helm 4 Key Features for Serverless OpenShift

Helm 4 introduces several enhancements that align with serverless OpenShift requirements:

  • Native OCI Registry Support: Helm 4 fully adopts OCI for chart storage, eliminating the need for dedicated chart repositories, which simplifies integration with OpenShift’s internal registry.
  • Improved Dependency Management: Smarter resolution of chart dependencies reduces conflicts when deploying multi-component serverless applications.
  • Serverless-Specific Hooks: New hooks for Knative service lifecycle events (e.g., pre-deploy for cold start optimization, post-deploy for traffic shifting) streamline serverless workflows.
  • Lightweight Chart Packaging: Reduced chart size and faster unpacking improve deployment speed for ephemeral serverless workloads.

Setting Up Serverless OpenShift for Helm 4

First, confirm your OpenShift Serverless installation is active:

oc get knativeserving -n knative-serving
# Expected output: NAME             VERSION   READY
#                knative-serving   1.28.0    True
Enter fullscreen mode Exit fullscreen mode

Next, configure Helm to use your OpenShift internal registry for OCI chart storage:

helm registry login -u $(oc whoami) -p $(oc whoami -t) image-registry.openshift-image-registry.svc:5000
# Create a namespace for Helm charts
oc new-project helm-serverless-charts
Enter fullscreen mode Exit fullscreen mode

Building a Helm 4 Chart for Knative Services

Create a new Helm chart for a sample serverless workload:

helm create serverless-hello
cd serverless-hello
Enter fullscreen mode Exit fullscreen mode

Modify the chart’s values.yaml to define Knative service parameters:

serverless:
  image: image-registry.openshift-image-registry.svc:5000/helm-serverless-charts/hello-serverless:v1
  revision:
    timeoutSeconds: 300
    concurrencyLimit: 50
  traffic:
    - tag: current
      percent: 100
      revisionName: serverless-hello-v1
Enter fullscreen mode Exit fullscreen mode

Update the templates/deployment.yaml to a Knative Service template (replace default deployment):

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: {{ include "serverless-hello.fullname" . }}
  labels:
    {{- include "serverless-hello.labels" . | nindent 4 }}
spec:
  template:
    spec:
      containers:
        - name: hello
          image: {{ .Values.serverless.image }}
          ports:
            - containerPort: 8080
          env:
            - name: HELLO_MESSAGE
              value: "Hello from Serverless OpenShift with Helm 4!"
  traffic:
    {{- toYaml .Values.serverless.traffic | nindent 4 }}
Enter fullscreen mode Exit fullscreen mode

Deploying the Serverless Chart with Helm 4

Package and push the chart to the OpenShift registry:

helm package serverless-hello
helm push serverless-hello-0.1.0.tgz oci://image-registry.openshift-image-registry.svc:5000/helm-serverless-charts
Enter fullscreen mode Exit fullscreen mode

Deploy the chart to your serverless namespace:

oc new-project serverless-workloads
helm install serverless-hello oci://image-registry.openshift-image-registry.svc:5000/helm-serverless-charts/serverless-hello --version 0.1.0 -n serverless-workloads
Enter fullscreen mode Exit fullscreen mode

Verify the Knative service is running:

oc get ksvc -n serverless-workloads
# Expected output: NAME             URL                                         READY   REASON
#                serverless-hello  https://serverless-hello.serverless-workloads.example.com  True
Enter fullscreen mode Exit fullscreen mode

Advanced Use Cases

Canary Deployments with Helm 4

Update values.yaml to split traffic between two revisions:

serverless:
  traffic:
    - tag: stable
      percent: 90
      revisionName: serverless-hello-v1
    - tag: canary
      percent: 10
      revisionName: serverless-hello-v2
Enter fullscreen mode Exit fullscreen mode

Upgrade the release to apply traffic changes:

helm upgrade serverless-hello oci://image-registry.openshift-image-registry.svc:5000/helm-serverless-charts/serverless-hello --version 0.2.0 -n serverless-workloads
Enter fullscreen mode Exit fullscreen mode

Event-Driven Serverless with Helm

Extend the chart to include Knative Eventing resources (e.g., Trigger, Broker) to handle event-driven workloads, using Helm 4’s dependency management to bundle eventing and serving components.

Best Practices

  • Version Charts Strictly: Use semantic versioning for Helm charts to track serverless workload changes.
  • Secure Chart Access: Use OpenShift RBAC to restrict who can push/pull Helm charts from the internal registry.
  • Integrate with CI/CD: Automate Helm chart packaging, pushing, and deployment via OpenShift Pipelines (Tekton).
  • Monitor with OpenShift Observability: Use Helm hooks to deploy monitoring sidecars for serverless workloads, and track metrics via Prometheus.

Conclusion

Helm 4’s tailored features for serverless workflows, combined with OpenShift’s enterprise-grade serverless capabilities, enable teams to deploy scalable, event-driven applications faster and more reliably. By following this practical guide, you can revolutionize your serverless deployment pipeline, reduce operational overhead, and optimize costs for ephemeral workloads. Start experimenting with Helm 4 on your OpenShift cluster today.

Top comments (0)