1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-06 06:46:26 +01:00
Files
openshift-docs/serverless/develop/serverless-applications.adoc
2022-01-31 12:11:59 -05:00

76 lines
2.6 KiB
Plaintext

:_content-type: ASSEMBLY
include::modules/serverless-document-attributes.adoc[]
[id="serverless-applications"]
= Serverless applications
include::modules/common-attributes.adoc[]
:context: serverless-applications
toc::[]
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 uses.
<3> The image of the application.
<4> The environment variable printed out by the sample application.
[id="serverless-applications-create"]
== Creating serverless applications
You can create a serverless application by using one of the following methods:
* Create a Knative service from the {product-title} web console. See the documentation about xref:../../applications/creating_applications/odc-creating-applications-using-developer-perspective.adoc#odc-creating-applications-using-developer-perspective[Creating applications using the Developer perspective].
* Create a Knative service using the `kn` CLI.
* Create and apply a YAML file.
// create service using CLI
include::modules/creating-serverless-apps-kn.adoc[leveloffset=+2]
include::modules/serverless-kn-container.adoc[leveloffset=+3]
// create service using YAML
include::modules/creating-serverless-apps-yaml.adoc[leveloffset=+2]
// Update services
include::modules/kn-service-update.adoc[leveloffset=+1]
// kn service apply
include::modules/kn-service-apply.adoc[leveloffset=+1]
// describe services
include::modules/kn-service-describe.adoc[leveloffset=+1]
include::modules/verifying-serverless-app-deployment.adoc[leveloffset=+1]
include::modules/interacting-serverless-apps-http2-gRPC.adoc[leveloffset=+1]
// Using Knative services w/ restrictive NetworkPolicies
include::modules/serverless-services-network-policies.adoc[leveloffset=+1]
// HTTPS redirection
include::modules/serverless-https-redirect-service.adoc[leveloffset=+1]
[id="serverless-applications-kn-offline-mode"]
== Using kn CLI in offline mode
:FeatureName: The offline mode of the kn CLI
include::modules/technology-preview.adoc[leveloffset=+1]
include::modules/kn-service-offline-about.adoc[leveloffset=+2]
include::modules/kn-service-offline-create.adoc[leveloffset=+2]