Skip to content

Commit 0192781

Browse files
authored
Merge pull request #31518 from abrennan89/SRVCLI-277
[srvls][SRVCLI-277] Updating knative services docs
2 parents 62de8ad + 40a979e commit 0192781

15 files changed

+238
-36
lines changed

_topic_map.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2880,9 +2880,6 @@ Topics:
28802880
File: serverless-serving-architecture
28812881
- Name: Knative Eventing
28822882
File: serverless-event-architecture
2883-
# Apps
2884-
- Name: Creating and managing serverless applications
2885-
File: serving-creating-managing-apps
28862883
# HA
28872884
- Name: High availability on OpenShift Serverless
28882885
File: serverless-HA
@@ -2893,7 +2890,10 @@ Topics:
28932890
- Name: Knative Serving
28942891
Dir: knative_serving
28952892
Topics:
2896-
# Knative services
2893+
# Knative services
2894+
- Name: Serverless applications
2895+
File: serverless-applications
2896+
# Autoscaling
28972897
- Name: Configuring Knative Serving autoscaling
28982898
File: configuring-knative-serving-autoscaling
28992899
- Name: Cluster logging with OpenShift Serverless
@@ -2966,3 +2966,9 @@ Topics:
29662966
Topics:
29672967
- Name: Using NVIDIA GPU resources with serverless applications
29682968
File: gpu-resources
2969+
# CLI reference guide
2970+
- Name: CLI reference
2971+
Dir: cli_reference
2972+
Topics:
2973+
- Name: kn service
2974+
File: kn-services-ref

modules/creating-serverless-apps-kn.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Module included in the following assemblies:
22
//
3-
// serverless/serving-creating-managing-apps.adoc
3+
// serverless/knative_serving/serverless-applications.adoc
44

55
[id="creating-serverless-apps-kn_{context}"]
66
= Creating serverless applications using the kn CLI

modules/creating-serverless-apps-yaml.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Module included in the following assemblies:
22
//
3-
// serverless/serving-creating-managing-apps.adoc
3+
// serverless/knative_serving/serverless-applications.adoc
44

55
[id="creating-serverless-apps-yaml_{context}"]
66
= Creating serverless applications using YAML

modules/interacting-serverless-apps-http2-gRPC.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Module included in the following assemblies:
22
//
3-
// * serverless/serving-creating-managing-apps.adoc
3+
// serverless/knative_serving/serverless-applications.adoc
44

55
[id="interacting-serverless-apps-http2-gRPC_{context}"]
66
= Interacting with a serverless application using HTTP2 and gRPC

modules/kn-service-apply.adoc

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * serverless/knative_serving/serverless-applications.adoc
4+
// * serverless/cli_reference/kn-services-ref.adoc
5+
6+
[id="kn-service-apply_{context}"]
7+
= Applying service declarations
8+
9+
You can declaratively configure a Knative service by using the `kn service apply` command. If the service does not exist it is created, otherwise the existing service is updated with the options that have been changed.
10+
11+
The `kn service apply` command is especially useful for shell scripts or in a continuous integration pipeline, where users typically want to fully specify the state of the service in a single command to declare the target state.
12+
13+
When using `kn service apply` you must provide the full configuration for the Knative service. This is different from the `kn service update` command, which only requires you to specify in the command the options that you want to update.
14+
15+
.Example commands
16+
17+
* Create a service:
18+
+
19+
[source,terminal]
20+
----
21+
$ kn service apply <service_name> --image <image>
22+
----
23+
24+
* Add an environment variable to a service:
25+
+
26+
[source,terminal]
27+
----
28+
$ kn service apply <service_name> --image <image> --env <key>=<value>
29+
----
30+
31+
* Read the service declaration from a JSON or YAML file:
32+
+
33+
[source,terminal]
34+
----
35+
$ kn service apply <service_name> -f <filename>
36+
----

modules/kn-service-describe.adoc

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * serverless/knative_serving/serverless-applications.adoc
4+
// * serverless/cli_reference/kn-services-ref.adoc
5+
6+
[id="kn-service-describe_{context}"]
7+
= Describing serverless applications
8+
9+
You can describe a Knative service by using the `kn service describe` command.
10+
11+
.Example commands
12+
13+
* Describe a service:
14+
+
15+
[source,terminal]
16+
----
17+
$ kn service describe --verbose <service_name>
18+
----
19+
+
20+
The `--verbose` flag is optional but can be included to provide a more detailed description. The difference between a regular and verbose output is shown in the following examples:
21+
+
22+
.Example output without `--verbose` flag
23+
[source,terminal]
24+
----
25+
Name: hello
26+
Namespace: default
27+
Age: 2m
28+
URL: http://hello-default.apps.ocp.example.com
29+
30+
Revisions:
31+
100% @latest (hello-00001) [1] (2m)
32+
Image: docker.io/openshift/hello-openshift (pinned to aaea76)
33+
34+
Conditions:
35+
OK TYPE AGE REASON
36+
++ Ready 1m
37+
++ ConfigurationsReady 1m
38+
++ RoutesReady 1m
39+
----
40+
+
41+
.Example output with `--verbose` flag
42+
[source,terminal]
43+
----
44+
Name: hello
45+
Namespace: default
46+
Annotations: serving.knative.dev/creator=system:admin
47+
serving.knative.dev/lastModifier=system:admin
48+
Age: 3m
49+
URL: http://hello-default.apps.ocp.example.com
50+
Cluster: http://hello.default.svc.cluster.local
51+
52+
Revisions:
53+
100% @latest (hello-00001) [1] (3m)
54+
Image: docker.io/openshift/hello-openshift (pinned to aaea76)
55+
Env: RESPONSE=Hello Serverless!
56+
57+
Conditions:
58+
OK TYPE AGE REASON
59+
++ Ready 3m
60+
++ ConfigurationsReady 3m
61+
++ RoutesReady 3m
62+
----
63+
64+
* Describe a service in YAML format:
65+
+
66+
[source,terminal]
67+
----
68+
$ kn service describe <service_name> -o yaml
69+
----
70+
71+
* Describe a service in JSON format:
72+
+
73+
[source,terminal]
74+
----
75+
$ kn service describe <service_name> -o json
76+
----
77+
78+
* Print the service URL only:
79+
+
80+
[source,terminal]
81+
----
82+
$ kn service describe <service_name> -o url
83+
----

modules/kn-service-update.adoc

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * serverless/knative_serving/serverless-applications.adoc
4+
// * serverless/cli_reference/kn-services-ref.adoc
5+
6+
[id="kn-service-update_{context}"]
7+
= Updating serverless applications
8+
9+
You can use the `kn service update` command for interactive sessions on the command line as you build up a service incrementally. In contrast to the `kn service apply` command, when using the `kn service update` command you only have to specify the changes that you want to update, rather than the full configuration for the Knative service.
10+
11+
.Example commands
12+
13+
* Update a service by adding a new environment variable:
14+
+
15+
[source,terminal]
16+
----
17+
$ kn service update <service_name> --env <key>=<value>
18+
----
19+
20+
* Update a service by adding a new port:
21+
+
22+
[source,terminal]
23+
----
24+
$ kn service update <service_name> --port 80
25+
----
26+
27+
* Update a service by adding new request and limit parameters:
28+
+
29+
[source,terminal]
30+
----
31+
$ kn service update <service_name> --request cpu=500m --limit memory=1024Mi --limit cpu=1000m
32+
----
33+
34+
* Assign the `latest` tag to a revision:
35+
+
36+
[source,terminal]
37+
----
38+
$ kn service update <service_name> --tag <revision_name>=latest
39+
----
40+
41+
* Update a tag from `testing` to `staging` for the latest `READY` revision of a service:
42+
+
43+
[source,terminal]
44+
----
45+
$ kn service update <service_name> --untag testing --tag @latest=staging
46+
----
47+
48+
* Add the `test` tag to a revision that receives 10% of traffic, and send the rest of the traffic to the latest `READY` revision of a service:
49+
+
50+
[source,terminal]
51+
----
52+
$ kn service update <service_name> --tag <revision_name>=test --traffic test=10,@latest=90
53+
----

modules/serverless-apps-intro.adoc

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Module is included in the following assemblies:
22
//
33
// serverless/knative_serving/serverless-knative-serving.adoc
4-
// serverless/serving-creating-managing-apps.adoc
4+
// serverless/knative_serving/serverless-applications.adoc
55

66
[id="serverless-about-services_{context}"]
77
= Serverless applications using Knative services
@@ -32,9 +32,3 @@ spec:
3232
<2> The namespace the application will use.
3333
<3> The image of the application.
3434
<4> The environment variable printed out by the sample application.
35-
36-
You can create a serverless application by using one of the following methods:
37-
38-
* Create a Knative service from the {product-title} web console.
39-
* Create a Knative service using the `kn` CLI.
40-
* Create and apply a YAML file.

modules/verifying-serverless-app-deployment.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Module included in the following assemblies:
22
//
3-
// * serverless/serving-creating-managing-apps.adoc
3+
// serverless/knative_serving/serverless-applications.adoc
44

55
[id="verifying-serverless-app-deployment_{context}"]
66
= Verifying your serverless application deployment

serverless/cli_reference/images

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../images

0 commit comments

Comments
 (0)