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

71 lines
2.7 KiB
Plaintext

:_content-type: ASSEMBLY
[id="serverless-applications"]
= Serverless applications
include::_attributes/common-attributes.adoc[]
:context: serverless-applications
toc::[]
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 {ServerlessProductName}, you must create a Knative `Service` object.
.Example Knative `Service` object YAML file
[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.
You can create a serverless application by using one of the following methods:
* Create a Knative service from the {product-title} web console.
+
ifdef::openshift-enterprise[]
See xref:../../applications/creating_applications/odc-creating-applications-using-developer-perspective.adoc#odc-creating-applications-using-developer-perspective[Creating applications using the Developer perspective] for more information.
endif::[]
* Create a Knative service by using the `kn` CLI.
* Create and apply a Knative `Service` object as a YAML file, by using the `oc` CLI.
// create service using CLI
include::modules/creating-serverless-apps-kn.adoc[leveloffset=+1]
// offline mode
include::modules/kn-service-offline-create.adoc[leveloffset=+1]
// create service using YAML
include::modules/creating-serverless-apps-yaml.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::[]
// should maybe move to admin guide? asked serving team
// HTTPS redirection
include::modules/serverless-https-redirect-service.adoc[leveloffset=+1]
// asked serving team why a user would need this for abstract rewrite, waiting for details
[id="additional-resources_serverless-applications"]
[role="_additional-resources"]
== Additional resources
* xref:../../serverless/cli_tools/kn-serving-ref.adoc#kn-serving-ref[Knative Serving CLI commands]
* xref:../../serverless/security/serverless-ossm-with-kourier-jwt.adoc#serverless-ossm-with-kourier-jwt[Configuring JSON Web Token authentication for Knative services]