mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-06 06:46:26 +01:00
41 lines
1.2 KiB
Plaintext
41 lines
1.2 KiB
Plaintext
// Module is included in the following assemblies:
|
|
//
|
|
// serverless/knative_serving/serverless-knative-serving.adoc
|
|
// serverless/serving-creating-managing-apps.adoc
|
|
|
|
[id="serverless-about-services_{context}"]
|
|
= Serverless applications using Knative services
|
|
|
|
To deploy a serverless application using {ServerlessProductName}, you must create a _Knative service_.
|
|
Knative services are Kubernetes services, defined by a route and a configuration, and contained in a YAML file.
|
|
|
|
.Example Knative service YAML
|
|
|
|
[source,yaml]
|
|
----
|
|
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 will use.
|
|
<3> The image of the application.
|
|
<4> The environment variable printed out by the sample application.
|
|
|
|
You can create a serverless application by using one of the following methods:
|
|
|
|
* Create a Knative service from the {product-title} web console.
|
|
* Create a Knative service using the `kn` CLI.
|
|
* Create and apply a YAML file.
|