Skip to content

Commit 345be44

Browse files
author
Michael Burke
committed
OSDOCS 16932 CQA 2.0 of NODES-4: Container/Pod Runtime Configuration II
1 parent af01f20 commit 345be44

16 files changed

Lines changed: 181 additions & 151 deletions

modules/nodes-containers-port-forwarding-about.adoc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,19 @@
66
[id="nodes-containers-port-forwarding-about_{context}"]
77
= Understanding port forwarding
88

9-
You can use the CLI to forward one or more local ports to a pod. This allows you
10-
to listen on a given or random port locally, and have data forwarded to and from
11-
given ports in the pod.
9+
[role="_abstract"]
10+
You can use the {oc-first} to forward one or more local ports to a pod. This allows you to listen on a given or random port locally, and have data forwarded to and from given ports in the pod.
1211

13-
Support for port forwarding is built into the CLI:
12+
You can use a command similar to the following to forward one or more local ports to a pod.
1413

1514
[source,terminal]
1615
----
1716
$ oc port-forward <pod> [<local_port>:]<remote_port> [...[<local_port_n>:]<remote_port_n>]
1817
----
1918

20-
The CLI listens on each local port specified by the user, forwarding using the protocol described below.
19+
The {oc-first} listens on each local port specified by the user, forwarding using the protocol described below.
2120

22-
Ports may be specified using the following formats:
21+
You can specify ports by using the following formats:
2322

2423
[horizontal]
2524
`5000`:: The client listens on port 5000 locally and forwards to 5000 in the

modules/nodes-containers-port-forwarding-protocol.adoc

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,25 @@
66
[id="nodes-containers-port-forwarding-protocol_{context}"]
77
= Protocol for initiating port forwarding from a client
88

9-
Clients initiate port forwarding to a pod by issuing a request to the
10-
Kubernetes API server:
9+
[role="_abstract"]
10+
A client resource in your cluster can initiate port forwarding to a pod by issuing a request to the Kubernetes API server.
1111

12+
Use a request in the following format:
13+
14+
[source,terminal]
1215
----
1316
/proxy/nodes/<node_name>/portForward/<namespace>/<pod>
1417
----
18+
where:
1519

16-
In the above URL:
17-
18-
- `<node_name>` is the FQDN of the node.
19-
- `<namespace>` is the namespace of the target pod.
20-
- `<pod>` is the name of the target pod.
21-
22-
For example:
20+
--
21+
`<node_name>`:: Specifies the FQDN of the node.
22+
`<namespace>`:: Specifies the namespace of the target pod.
23+
`<pod>`:: Specifies the name of the target pod.
24+
--
2325

26+
.Example request
27+
[source,terminal]
2428
----
2529
/proxy/nodes/node123.openshift.com/portForward/myns/mypod
2630
----

modules/nodes-containers-port-forwarding-using.adoc

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,19 @@
66
[id="nodes-containers-port-forwarding-using_{context}"]
77
= Using port forwarding
88

9-
You can use the CLI to port-forward one or more local ports to a pod.
9+
[role="_abstract"]
10+
You can use the {oc-first} to port-forward one or more local ports to a pod.
1011

1112
.Procedure
1213

13-
Use the following command to listen on the specified port in a pod:
14-
14+
* Use a command similar to the following to listen on the specified port in a pod:
15+
+
1516
[source,terminal]
1617
----
1718
$ oc port-forward <pod> [<local_port>:]<remote_port> [...[<local_port_n>:]<remote_port_n>]
1819
----
19-
20-
For example:
21-
22-
* Use the following command to listen on ports `5000` and `6000` locally and forward data to and from ports `5000` and `6000` in the pod:
20+
+
21+
For example, use the following command to listen on ports `5000` and `6000` locally and forward data to and from ports `5000` and `6000` in the pod:
2322
+
2423
[source,terminal]
2524
----
@@ -34,8 +33,8 @@ Forwarding from [::1]:5000 -> 5000
3433
Forwarding from 127.0.0.1:6000 -> 6000
3534
Forwarding from [::1]:6000 -> 6000
3635
----
37-
38-
* Use the following command to listen on port `8888` locally and forward to `5000` in the pod:
36+
+
37+
For example, use the following command to listen on port `8888` locally and forward to `5000` in the pod:
3938
+
4039
[source,terminal]
4140
----
@@ -48,8 +47,8 @@ $ oc port-forward <pod> 8888:5000
4847
Forwarding from 127.0.0.1:8888 -> 5000
4948
Forwarding from [::1]:8888 -> 5000
5049
----
51-
52-
* Use the following command to listen on a free port locally and forward to `5000` in the pod:
50+
+
51+
For example, use the following command to listen on a free port locally and forward to `5000` in the pod:
5352
+
5453
[source,terminal]
5554
----
@@ -63,7 +62,7 @@ Forwarding from 127.0.0.1:42390 -> 5000
6362
Forwarding from [::1]:42390 -> 5000
6463
----
6564
+
66-
Or:
65+
Alternatively, use the following command to listen on a free port locally and forward to `5000` in the pod:
6766
+
6867
[source,terminal]
6968
----

modules/nodes-containers-remote-commands-about.adoc

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,31 @@
66
[id="nodes-containers-remote-commands-about_{context}"]
77
= Executing remote commands in containers
88

9-
Support for remote container command execution is built into the CLI.
9+
[role="_abstract"]
10+
You can use the {oc-first} to execute remote commands in {product-title} containers. By running commands in a container, you can perform troubleshooting, inspect logs, run scripts, and other tasks.
1011

1112
.Procedure
1213

13-
To run a command in a container:
14-
14+
* Use a command similar to the following to run a command in a container:
15+
+
1516
[source,terminal]
1617
----
1718
$ oc exec <pod> [-c <container>] -- <command> [<arg_1> ... <arg_n>]
1819
----
19-
20+
+
2021
For example:
21-
22+
+
2223
[source,terminal]
2324
----
2425
$ oc exec mypod date
2526
----
26-
27+
+
2728
.Example output
2829
[source,terminal]
2930
----
3031
Thu Apr 9 02:21:53 UTC 2015
3132
----
32-
33+
+
3334
[IMPORTANT]
3435
====
3536
link:https://access.redhat.com/errata/RHSA-2015:1650[For security purposes], the

modules/nodes-containers-remote-commands-protocol.adoc

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,37 @@
66
[id="nodes-containers-remote-commands-protocol_{context}"]
77
= Protocol for initiating a remote command from a client
88

9-
Clients initiate the execution of a remote command in a container by issuing a
10-
request to the Kubernetes API server:
9+
[role="_abstract"]
10+
A client resource in your cluster can initiate the execution of a remote command in a container by issuing a request to the Kubernetes API server.
11+
12+
The following example is the format for a typical request to a Kubernetes API server:
1113

1214
[source,terminal]
1315
----
1416
/proxy/nodes/<node_name>/exec/<namespace>/<pod>/<container>?command=<command>
1517
----
18+
where:
1619

17-
In the above URL:
18-
19-
- `<node_name>` is the FQDN of the node.
20-
- `<namespace>` is the project of the target pod.
21-
- `<pod>` is the name of the target pod.
22-
- `<container>` is the name of the target container.
23-
- `<command>` is the desired command to be executed.
24-
25-
For example:
20+
--
21+
`<node_name>`:: Specifies the FQDN of the node.
22+
`<namespace>`:: Specifies the project of the target pod.
23+
`<pod>`:: Specifies the name of the target pod.
24+
`<container>`:: Specifies the name of the target container.
25+
`<command>`:: Specifies the desired command to be executed.
26+
--
2627

28+
.Example request
2729
[source,terminal]
2830
----
2931
/proxy/nodes/node123.openshift.com/exec/myns/mypod/mycontainer?command=date
3032
----
3133

32-
Additionally, the client can add parameters to the request to indicate if:
34+
Additionally, the client can add parameters to the request to indicate any of the following conditions:
3335

34-
- the client should send input to the remote container's command (stdin).
35-
- the client's terminal is a TTY.
36-
- the remote container's command should send output from stdout to the client.
37-
- the remote container's command should send output from stderr to the client.
36+
* The client should send input to the remote container's command (stdin).
37+
* The client's terminal is a TTY.
38+
* The remote container's command should send output from stdout to the client.
39+
* The remote container's command should send output from stderr to the client.
3840
3941
After sending an `exec` request to the API server, the client upgrades the
4042
connection to one that supports multiplexed streams; the current implementation

modules/nodes-containers-start-pod-safe-sysctls.adoc

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
[id="nodes-starting-pod-safe-sysctls_{context}"]
77
= Starting a pod with safe sysctls
88

9-
You can set sysctls on pods using the pod's `securityContext`. The `securityContext` applies to all containers in the same pod.
9+
[role="_abstract"]
10+
You can modify kernel parameters for all containers in a pod by adding the sysctls parameter to the `securityContext` parameter in a pod spec.
1011

1112
Safe sysctls are allowed by default.
1213

@@ -22,7 +23,8 @@ This example uses the pod `securityContext` to set the following safe sysctls:
2223
To avoid destabilizing your operating system, modify sysctl parameters only after you understand their effects.
2324
====
2425

25-
Use this procedure to start a pod with the configured sysctl settings.
26+
The following procedure shows how to start a pod with the configured sysctl settings.
27+
2628
[NOTE]
2729
====
2830
In most cases you modify an existing pod definition and add the `securityContext` spec.
@@ -46,14 +48,14 @@ spec:
4648
image: centos
4749
command: ["bin/bash", "-c", "sleep INF"]
4850
securityContext:
49-
runAsUser: 2000 <1>
50-
runAsGroup: 3000 <2>
51-
allowPrivilegeEscalation: false <3>
52-
capabilities: <4>
51+
runAsUser: 2000
52+
runAsGroup: 3000
53+
allowPrivilegeEscalation: false
54+
capabilities:
5355
drop: ["ALL"]
5456
securityContext:
55-
runAsNonRoot: true <5>
56-
seccompProfile: <6>
57+
runAsNonRoot: true
58+
seccompProfile:
5759
type: RuntimeDefault
5860
sysctls:
5961
- name: kernel.shm_rmid_forced
@@ -65,21 +67,25 @@ spec:
6567
- name: net.ipv4.ping_group_range
6668
value: "0 200000000"
6769
----
68-
<1> `runAsUser` controls which user ID the container is run with.
69-
<2> `runAsGroup` controls which primary group ID the containers is run with.
70-
<3> `allowPrivilegeEscalation` determines if a pod can request to allow privilege escalation. If unspecified, it defaults to true. This boolean directly controls whether the `no_new_privs` flag gets set on the container process.
71-
<4> `capabilities` permit privileged actions without giving full root access. This policy ensures all capabilities are dropped from the pod.
72-
<5> `runAsNonRoot: true` requires that the container will run with a user with any UID other than 0.
73-
<6> `RuntimeDefault` enables the default seccomp profile for a pod or container workload.
70+
where:
71+
72+
`spec.containers.securityContext.runAsUser`:: Specifies which user ID the container is run with.
73+
`spec.containers.securityContext.runAsGroup`:: Specifies which primary group ID the containers is run with.
74+
`spec.containers.securityContext.allowPrivilegeEscalation`:: Specifies whether a pod can request privilege escalation. The default is `true`. This boolean directly controls whether the `no_new_privs` flag gets set on the container process.
75+
`spec.containers.securityContext.capabilities`:: Specifies permitted privileged actions without giving full root access. This policy ensures all capabilities are dropped from the pod.
76+
`spec.securityContext.runAsNonRoot: true`:: Specifies that the container runs with a user with any UID other than 0.
77+
`spec.securityContext.seccompProfile.type: RuntimeDefault`:: Specifies that the default seccomp profile is enabled for a pod or container workload.
7478

7579
. Create the pod by running the following command:
7680
+
7781
[source,terminal]
7882
----
7983
$ oc apply -f sysctl_pod.yaml
8084
----
81-
+
82-
. Verify that the pod is created by running the following command:
85+
86+
.Verification
87+
88+
. Check that the pod is created by running the following command:
8389
+
8490
[source,terminal]
8591
----

modules/nodes-containers-sysctls-about.adoc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,20 @@
66
[id="nodes-containers-sysctls-about_{context}"]
77
= About sysctls
88

9-
In Linux, the sysctl interface allows an administrator to modify kernel parameters at runtime. Parameters are available from the `_/proc/sys/_` virtual process file system. The parameters cover various subsystems, such as:
9+
[role="_abstract"]
10+
The Linux sysctl interface allows you to modify kernel parameters at runtime to manage subsystems such as networking, virtual memory, and MDADM. By accessing the sysctl interface, you can view and adjust system configurations without rebooting the operating system.
11+
12+
You can modify the following subsystems by using sysctls:
1013

1114
- kernel (common prefix: `_kernel._`)
1215
- networking (common prefix: `_net._`)
1316
- virtual memory (common prefix: `_vm._`)
1417
- MDADM (common prefix: `_dev._`)
1518
16-
More subsystems are described in link:https://www.kernel.org/doc/Documentation/sysctl/README[Kernel documentation].
17-
To get a list of all parameters, run:
19+
Refer to the link:https://www.kernel.org/doc/Documentation/sysctl/README[Kernel.org documentation] for more information on the subsystems you can manage.
20+
You can get a list of all parameters by running the following command:
1821

1922
[source,terminal]
2023
----
2124
$ sudo sysctl -a
22-
----
25+
----

modules/nodes-containers-sysctls-setting.adoc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
[id="nodes-containers-starting-pod-with-unsafe-sysctls_{context}"]
77
= Starting a pod with unsafe sysctls
88

9-
A pod with unsafe sysctls fails to launch on any node unless the cluster administrator explicitly enables unsafe sysctls for that node. As with node-level sysctls, use the taints and toleration feature or labels on nodes to schedule those pods onto the right nodes.
9+
[role="_abstract"]
10+
You can run a pod that is configured to use unsafe sysctls on a node where a cluster administrator explicitly enabled unsafe sysctls. You might use unsafe sysctls for situations such as high performance or real-time application tuning.
11+
12+
You can use the taints and toleration feature or labels on nodes to schedule those pods onto the right nodes.
1013

1114
The following example uses the pod `securityContext` to set a safe sysctl `kernel.shm_rmid_forced` and two unsafe sysctls, `net.core.somaxconn` and `kernel.msgmax`. There is no distinction between _safe_ and _unsafe_ sysctls in the specification.
1215

@@ -51,7 +54,7 @@ spec:
5154
value: "65536"
5255
----
5356

54-
. Create the pod using the following command:
57+
. Create the pod by using the following command:
5558
+
5659
[source,terminal]
5760
----

0 commit comments

Comments
 (0)