Skip to content

Commit e852635

Browse files
authored
Merge pull request #37594 from abrennan89/multicontainer
SRVCLI-317: Docs for kn container
2 parents b1d8863 + 1f5848f commit e852635

File tree

3 files changed

+85
-2
lines changed

3 files changed

+85
-2
lines changed

modules/serverless-kn-container.adoc

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * serverless/cli_tools/kn-serving-ref.adoc
4+
// * serverless/knative_serving/serverless-applications.adoc
5+
6+
[id="serverless-kn-container_{context}"]
7+
= Knative client multi-container support
8+
9+
You can use the `kn container add` command to print YAML container spec to standard output. This command is useful for multi-container use cases because it can be used along with other standard `kn` flags to create definitions. The `kn container add` command accepts all container-related flags that are supported for use with the `kn service create` command. The `kn container add` command can also be chained by using UNIX pipes (`|`) to create multiple container definitions at once.
10+
11+
[id="serverless-kn-container-examples_{context}"]
12+
== Example commands
13+
14+
* Add a container from an image and print it to standard output:
15+
+
16+
[source,terminal]
17+
----
18+
$ kn container add <container_name> --image <image_uri>
19+
----
20+
+
21+
.Example command
22+
[source,terminal]
23+
----
24+
$ kn container add sidecar --image docker.io/example/sidecar
25+
----
26+
+
27+
.Example output
28+
[source,terminal]
29+
----
30+
containers:
31+
- image: docker.io/example/sidecar
32+
name: sidecar
33+
resources: {}
34+
----
35+
36+
* Chain two `kn container add` commands together, and then pass them to a `kn service create` command to create a Knative service with two containers:
37+
+
38+
[source,terminal]
39+
----
40+
$ kn container add <first_container_name> --image <image_uri> | \
41+
kn container add <second_container_name> --image <image_uri> | \
42+
kn service create <service_name> --image <image_uri> --extra-containers -
43+
----
44+
+
45+
`--extra-containers -` specifies a special case where `kn` reads the pipe input instead of a YAML file.
46+
+
47+
.Example command
48+
[source,terminal]
49+
----
50+
$ kn container add sidecar --image docker.io/example/sidecar:first | \
51+
kn container add second --image docker.io/example/sidecar:second | \
52+
kn service create my-service --image docker.io/example/my-app:latest --extra-containers -
53+
----
54+
+
55+
The `--extra-containers` flag can also accept a path to a YAML file:
56+
+
57+
[source,terminal]
58+
----
59+
$ kn service create <service_name> --image <image_uri> --extra-containers <filename>
60+
----
61+
+
62+
.Example command
63+
[source,terminal]
64+
----
65+
$ kn service create my-service --image docker.io/example/my-app:latest --extra-containers my-extra-containers.yaml
66+
----

serverless/cli_tools/kn-serving-ref.adoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ include::modules/kn-service-update.adoc[leveloffset=+2]
1818
include::modules/kn-service-apply.adoc[leveloffset=+2]
1919
include::modules/kn-service-describe.adoc[leveloffset=+2]
2020

21+
////
22+
[id="kn-serving-ref-kn-container"]
23+
== kn container commands
24+
25+
You can use the following commands to create and manage multiple containers in a Knative service spec.
26+
27+
include::modules/serverless-kn-container.adoc[leveloffset=+2]
28+
////
29+
// Uncomment at 1.19.0 release
30+
2131
[id="kn-serving-ref-domain-mapping"]
2232
== kn domain commands
2333

serverless/knative_serving/serverless-applications.adoc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,19 @@ You can create a serverless application by using one of the following methods:
1717
* Create a Knative service using the `kn` CLI.
1818
* Create and apply a YAML file.
1919

20-
=== Creating serverless applications using the Developer perspective
20+
[id="serverless-applications-web-console"]
21+
=== Creating serverless applications using the {product-title} web console
2122

22-
For more information about creating applications using the *Developer* perspective in {product-title}, see the documentation on xref:../../applications/creating_applications/odc-creating-applications-using-developer-perspective.adoc#odc-creating-applications-using-developer-perspective[Creating applications using the Developer perspective].
23+
For more information about creating applications using the *Developer* perspective in the {product-title} web console, see the documentation on xref:../../applications/creating_applications/odc-creating-applications-using-developer-perspective.adoc#odc-creating-applications-using-developer-perspective[Creating applications using the Developer perspective].
2324

2425
// TODO: Add admin perspective service docs
26+
// create service using CLI
2527
include::modules/creating-serverless-apps-kn.adoc[leveloffset=+2]
28+
29+
// Uncomment at 1.19.0
30+
// include::modules/serverless-kn-container.adoc[leveloffset=+3]
31+
32+
// create service using YAML
2633
include::modules/creating-serverless-apps-yaml.adoc[leveloffset=+2]
2734

2835
// Update services

0 commit comments

Comments
 (0)