×

If you do not want to switch to the Developer perspective in the OpenShift Container Platform web console or use the Knative (kn) CLI or YAML files, you can create Knative components by using the Administator perspective of the OpenShift Container Platform web console.

Creating serverless applications using the Administrator perspective

Serverless applications are created and deployed as Kubernetes services, defined by a route and a configuration, and contained in a YAML file. To deploy a serverless application using OpenShift Serverless, you must create a Knative Service object.

Example Knative Service object YAML file
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: hello (1)
  namespace: default (2)
spec:
  template:
    spec:
      containers:
        - image: docker.io/openshift/hello-openshift (3)
          env:
            - name: RESPONSE (4)
              value: "Hello Serverless!"
1 The name of the application.
2 The namespace the application uses.
3 The image of the application.
4 The environment variable printed out by the sample application.

After the service is created and the application is deployed, Knative creates an immutable revision for this version of the application. Knative also performs network programming to create a route, ingress, service, and load balancer for your application and automatically scales your pods up and down based on traffic.

Prerequisites

To create serverless applications using the Administrator perspective, ensure that you have completed the following steps.

  • The OpenShift Serverless Operator and Knative Serving are installed.

  • You have logged in to the web console and are in the Administrator perspective.

Procedure
  1. Navigate to the ServerlessServing page.

  2. In the Create list, select Service.

  3. Manually enter YAML or JSON definitions, or by dragging and dropping a file into the editor.

  4. Click Create.

Creating an event source by using the Administrator perspective

A Knative event source can be any Kubernetes object that generates or imports cloud events, and relays those events to another endpoint, known as a sink. Sourcing events is critical to developing a distributed system that reacts to events.

Prerequisites
  • The OpenShift Serverless Operator and Knative Eventing are installed on your OpenShift Container Platform cluster.

  • You have logged in to the web console and are in the Administrator perspective.

  • You have cluster administrator permissions for OpenShift Container Platform.

Procedure
  1. In the Administrator perspective of the OpenShift Container Platform web console, navigate to ServerlessEventing.

  2. In the Create list, select Event Source. You will be directed to the Event Sources page.

  3. Select the event source type that you want to create.

Creating a broker by using the Administrator perspective

Brokers can be used in combination with triggers to deliver events from an event source to an event sink. Events are sent from an event source to a broker as an HTTP POST request. After events have entered the broker, they can be filtered by CloudEvent attributes using triggers, and sent as an HTTP POST request to an event sink.

Broker event delivery overview
Prerequisites
  • The OpenShift Serverless Operator and Knative Eventing are installed on your OpenShift Container Platform cluster.

  • You have logged in to the web console and are in the Administrator perspective.

  • You have cluster administrator permissions for OpenShift Container Platform.

Procedure
  1. In the Administrator perspective of the OpenShift Container Platform web console, navigate to ServerlessEventing.

  2. In the Create list, select Broker. You will be directed to the Create Broker page.

  3. Optional: Modify the YAML configuration for the broker.

  4. Click Create.

Creating a trigger by using the Administrator perspective

Brokers can be used in combination with triggers to deliver events from an event source to an event sink. Events are sent from an event source to a broker as an HTTP POST request. After events have entered the broker, they can be filtered by CloudEvent attributes using triggers, and sent as an HTTP POST request to an event sink.

Broker event delivery overview
Prerequisites
  • The OpenShift Serverless Operator and Knative Eventing are installed on your OpenShift Container Platform cluster.

  • You have logged in to the web console and are in the Administrator perspective.

  • You have cluster administrator permissions for OpenShift Container Platform.

  • You have created a Knative broker.

  • You have created a Knative service to use as a subscriber.

Procedure
  1. In the Administrator perspective of the OpenShift Container Platform web console, navigate to ServerlessEventing.

  2. In the Broker tab, select the Options menu kebab for the broker that you want to add a trigger to.

  3. Click Add Trigger in the list.

  4. In the Add Trigger dialogue box, select a Subscriber for the trigger. The subscriber is the Knative service that will receive events from the broker.

  5. Click Add.

Creating a channel by using the Administrator perspective

Channels are custom resources that define a single event-forwarding and persistence layer. After events have been sent to a channel from an event source or producer, these events can be sent to multiple Knative services or other sinks by using a subscription.

Channel workflow overview

You can create channels by instantiating a supported Channel object, and configure re-delivery attempts by modifying the delivery spec in a Subscription object.

Prerequisites
  • The OpenShift Serverless Operator and Knative Eventing are installed on your OpenShift Container Platform cluster.

  • You have logged in to the web console and are in the Administrator perspective.

  • You have cluster administrator permissions for OpenShift Container Platform.

Procedure
  1. In the Administrator perspective of the OpenShift Container Platform web console, navigate to ServerlessEventing.

  2. In the Create list, select Channel. You will be directed to the Channel page.

  3. Select the type of Channel object that you want to create in the Type list.

    Currently only InMemoryChannel channel objects are supported by default. Kafka channels are available if you have installed Knative Kafka on OpenShift Serverless.

  4. Click Create.

Creating a subscription by using the Administrator perspective

After you have created a channel and an event sink, also known as a subscriber, you can create a subscription to enable event delivery. Subscriptions are created by configuring a Subscription object, which specifies the channel and the subscriber to deliver events to. You can also specify some subscriber-specific options, such as how to handle failures.

Prerequisites
  • The OpenShift Serverless Operator and Knative Eventing are installed on your OpenShift Container Platform cluster.

  • You have logged in to the web console and are in the Administrator perspective.

  • You have cluster administrator permissions for OpenShift Container Platform.

  • You have created a Knative channel.

  • You have created a Knative service to use as a subscriber.

Procedure
  1. In the Administrator perspective of the OpenShift Container Platform web console, navigate to ServerlessEventing.

  2. In the Channel tab, select the Options menu kebab for the channel that you want to add a subscription to.

  3. Click Add Subscription in the list.

  4. In the Add Subscription dialogue box, select a Subscriber for the subscription. The subscriber is the Knative service that receives events from the channel.

  5. Click Add.