Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours scrolling social media and waste money on things we forget, but won’t spend 30 minutes a day earning certifications that can change our lives.
Master in DevOps, SRE, DevSecOps & MLOps by DevOpsSchool!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

Openshift: Lab 14 – Setting up and using OpenShift Serverless Functions

Manual – https://docs.redhat.com/en/documentation/red_hat_openshift_serverless/1.30/html/functions/index

OpenShift Serverless Function is a feature of Red Hat OpenShift that enables you to build, deploy, and manage event-driven serverless workloads using the Function-as-a-Service (FaaS) paradigm, directly on OpenShift. It is built on top of Knative (an open-source Kubernetes-based serverless framework), but provides a more developer-friendly and integrated experience for creating “functions”—small, single-purpose pieces of code that run in response to events.


Key Points about OpenShift Serverless Function

1. What is a Serverless Function?

  • A serverless function is a small piece of code that is executed in response to an event (HTTP request, message in a queue, etc.).
  • You don’t manage the underlying servers; OpenShift/Kubernetes automatically scales the function up or down (even to zero) based on demand.

2. How does OpenShift Serverless Function work?

  • Functions are created using a CLI (kn func or oc) or the OpenShift web console.
  • Functions can be written in languages like Node.js, Python, Go, Java, Quarkus, TypeScript, etc.
  • Code is packaged as a container image and deployed as a Knative Service.
  • OpenShift automatically handles scaling, routing, and event integration.

3. Why use OpenShift Serverless Function?

  • Rapid development: Focus on writing business logic; the platform handles build, deployment, and scaling.
  • Event-driven: Functions can be triggered by events like HTTP requests, Kafka messages, or cloud events.
  • Efficient resource usage: Functions scale to zero when not in use, saving costs and resources.
  • Integrated developer experience: CLI and IDE tools help you scaffold, build, test, and deploy functions easily.

4. How is it different from plain Knative?

  • OpenShift Serverless Function provides a streamlined developer workflow and templates, plus deeper integration with OpenShift features (e.g., pipelines, security, monitoring).
  • Focuses on the function lifecycle (scaffolding, local development, automated builds) versus raw Knative, where you deal more with YAML and manual setup.

Typical Workflow

  1. Initialize a Function: kn func create --runtime node --name hello-func
  2. Develop Locally: Write your logic (e.g., index.js or app.py).
  3. Build and Deploy: kn func deploy
    • This builds the function, creates a container image, and deploys it as a Knative Service.
  4. Trigger the Function: By HTTP request, event source, or via API gateway.
  5. Auto-scaling: OpenShift will scale the function pods up/down based on incoming events (can scale down to zero).

Common Use Cases

  • API endpoints (microservices)
  • Data transformation pipelines
  • Event-driven automation (e.g., on new file upload, process file)
  • Webhooks
  • Lightweight background tasks

Summary Table

FeatureOpenShift Serverless Function
Underlying TechKnative
LanguagesNode.js, Python, Go, Java, etc.
TriggerHTTP, Kafka, CloudEvents, etc.
ScalabilityAuto, incl. scale to zero
DeploymentVia CLI or Web Console
IntegrationsOpenShift Pipelines, Git, etc.

References


Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.

0
Would love your thoughts, please comment.x
()
x