第4章 Getting started with Knative services
You are viewing documentation for a release of Red Hat OpenShift Serverless that is no longer supported. Red Hat OpenShift Serverless is currently supported on OpenShift Container Platform 4.3 and newer.
Knative services are Kubernetes services that a user creates to deploy a serverless application. Each Knative service is defined by a route and a configuration, contained in a .yaml
file.
4.1. Creating a Knative service
To create a service, you must create the service.yaml
file.
You can copy the sample below. This sample will create a sample golang application called helloworld-go
and allows you to specify the image for that application.
apiVersion: serving.knative.dev/v1alpha1 1 kind: Service metadata: name: helloworld-go 2 namespace: default 3 spec: template: spec: containers: - image: gcr.io/knative-samples/helloworld-go 4 env: - name: TARGET 5 value: "Go Sample v1"