1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-07 00:48:01 +01:00
Files
openshift-docs/serverless/develop/serverless-applications.adoc
2022-02-25 16:48:31 -05:00

92 lines
3.1 KiB
Plaintext

:_content-type: ASSEMBLY
[id="serverless-applications"]
= Serverless applications
include::_attributes/common-attributes.adoc[]
include::_attributes/serverless-document-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:
ifdef::openshift-enterprise[]
* 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].
endif::[]
ifdef::openshift-dedicated[]
* Create a Knative service from the {product-title} web console.
endif::[]
// TODO: remove conditional once Applications docs are available in OSD
* 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]
// OCP only
ifdef::openshift-enterprise[]
// Using Knative services w/ restrictive NetworkPolicies
include::modules/serverless-services-network-policies.adoc[leveloffset=+1]
endif::[]
[role="_additional-resources"]
.Additional resources
* See xref:../../serverless/security/serverless-ossm-with-kourier-jwt.adoc#serverless-ossm-with-kourier-jwt[Configuring JSON Web Token authentication for Knative services].
// 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::snippets/technology-preview.adoc[leveloffset=+1]
include::modules/kn-service-offline-about.adoc[leveloffset=+2]
include::modules/kn-service-offline-create.adoc[leveloffset=+2]