1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 21:46:22 +01:00
Files
openshift-docs/modules/serverless-workflow-basic.adoc
2020-06-18 18:06:45 +00:00

128 lines
2.7 KiB
Plaintext

// Module is included in the following assemblies:
//
// serverless/knative_cli/knative-cli.adoc
[id="basic-workflow_{context}"]
= Basic workflow using `kn`
The following basic workflow deploys a simple `hello` service that reads the environment variable `RESPONSE` and prints its output.
You can use this guide as a reference to perform create, read, update, and delete (CRUD) operations on a service.
.Procedure
. Create a service in the `default` namespace from an image:
+
----
$ kn service create hello --image docker.io/openshift/hello-openshift --env RESPONSE="Hello Serverless!"
----
+
.Example output
+
----
Creating service 'hello' in namespace 'default':
0.085s The Route is still working to reflect the latest desired specification.
0.101s Configuration "hello" is waiting for a Revision to become ready.
11.590s ...
11.650s Ingress has not yet been reconciled.
11.726s Ready to serve.
Service 'hello' created with latest revision 'hello-gsdks-1' and URL:
http://hello-default.apps-crc.testing
----
. List the service:
+
----
$ kn service list
----
+
.Example output
----
NAME URL LATEST AGE CONDITIONS READY REASON
hello http://hello-default.apps-crc.testing hello-gsdks-1 8m35s 3 OK / 3 True
----
. Check if the service is working by using the `curl` service endpoint command:
+
----
$ curl http://hello-default.apps-crc.testing
----
+
.Example output
+
----
Hello Serverless!
----
. Update the service:
+
----
$ kn service update hello --env RESPONSE="Hello OpenShift!"
----
+
.Example output
+
----
Updating Service 'hello' in namespace 'default':
10.136s Traffic is not yet migrated to the latest revision.
10.175s Ingress has not yet been reconciled.
10.348s Ready to serve.
Service 'hello' updated with latest revision 'hello-dghll-2' and URL:
http://hello-default.apps-crc.testing
----
+
The service's environment variable `RESPONSE` is now set to "Hello OpenShift!".
. Describe the service.
+
----
$ kn service describe hello
----
+
.Example output
+
----
Name: hello
Namespace: default
Age: 13m
URL: http://hello-default.apps-crc.testing
Revisions:
100% @latest (hello-dghll-2) [2] (1m)
Image: docker.io/openshift/hello-openshift (pinned to 5ea96b)
Conditions:
OK TYPE AGE REASON
++ Ready 1m
++ ConfigurationsReady 1m
++ RoutesReady 1m
----
. Delete the service:
+
----
$ kn service delete hello
----
+
.Example output
+
----
Service 'hello' successfully deleted in namespace 'default'.
----
+
Verify that the `hello` service is deleted by attempting to `list` it:
+
----
$ kn service list hello
----
+
.Example output
+
----
No services found.
----