Skip to content

Commit 425a01d

Browse files
authored
Merge pull request #34464 from mburke5678/BZ-1950408
BZ1950408: Can't SSH into RHCOS nodes - runc modified /dev/ptmx symlink (hostPath)
2 parents ac17503 + b137fa8 commit 425a01d

8 files changed

+44
-17
lines changed

modules/nodes-containers-volumes-adding.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ character.
3737
|`'*'`
3838

3939
|`-m, --mount-path`
40-
|Mount path inside the selected containers.
40+
|Mount path inside the selected containers. Do not mount to the container root, `/`, or any path that is the same in the host and the container. This can corrupt your host system if the container is sufficiently privileged, such as the host `/dev/pts` files. It is safe to mount the host by using `/host`.
4141
|
4242

4343
|`--path`
44-
|Host path. Mandatory parameter for `--type=hostPath`.
44+
|Host path. Mandatory parameter for `--type=hostPath`. Do not mount to the container root, `/`, or any path that is the same in the host and the container. This can corrupt your host system if the container is sufficiently privileged, such as the host `/dev/pts` files. It is safe to mount the host by using `/host`.
4545
|
4646

4747
|`--secret-name`

modules/nodes-pods-using-example.adoc

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ spec:
5555
volumeMounts: <5>
5656
- name: default-token-wbqsl
5757
readOnly: true
58-
mountPath: /var/run/secrets/kubernetes.io/serviceaccount
58+
mountPath: /var/run/secrets/kubernetes.io/serviceaccount <6>
5959
terminationMessagePolicy: File
60-
image: registry.redhat.io/openshift4/ose-ogging-eventrouter:v4.3 <6>
61-
serviceAccount: default <7>
62-
volumes: <8>
60+
image: registry.redhat.io/openshift4/ose-ogging-eventrouter:v4.3 <7>
61+
serviceAccount: default <8>
62+
volumes: <9>
6363
- name: default-token-wbqsl
6464
secret:
6565
secretName: default-token-wbqsl
@@ -107,10 +107,11 @@ status:
107107
<2> The pod restart policy with possible values `Always`, `OnFailure`, and `Never`. The default value is `Always`.
108108
<3> {product-title} defines a security context for containers which specifies whether they are allowed to run as privileged containers, run as a user of their choice, and more. The default context is very restrictive but administrators can modify this as needed.
109109
<4> `containers` specifies an array of one or more container definitions.
110-
<5> The container specifies where external storage volumes are mounted within the container. In this case, there is a volume for storing the default the CA bundle.
111-
<6> Each container in the pod is instantiated from its own container image.
112-
<7> Pods making requests against the {product-title} API is a common enough pattern that there is a `serviceAccount` field for specifying which service account user the pod should authenticate as when making the requests. This enables fine-grained access control for custom infrastructure components.
113-
<8> The pod defines storage volumes that are available to its container(s) to use. In this case, it provides an ephemeral volume for a `secret` volume containing the default service account tokens.
110+
<5> The container specifies where external storage volumes are mounted within the container. In this case, there is a volume for storing access to credentials the registry needs for making requests against the {product-title} API.
111+
<6> Specify the volumes to provide for the pod. Volumes mount at the specified path. Do not mount to the container root, `/`, or any path that is the same in the host and the container. This can corrupt your host system if the container is sufficiently privileged, such as the host `/dev/pts` files. It is safe to mount the host by using `/host`.
112+
<7> Each container in the pod is instantiated from its own container image.
113+
<8> Pods making requests against the {product-title} API is a common enough pattern that there is a `serviceAccount` field for specifying which service account user the pod should authenticate as when making the requests. This enables fine-grained access control for custom infrastructure components.
114+
<9> The pod defines storage volumes that are available to its container(s) to use. In this case, it provides an ephemeral volume for a `secret` volume containing the default service account tokens.
114115

115116
[NOTE]
116117
====

modules/persistent-storage-hostpath-about.adoc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,29 @@
1010
In a production cluster, you would not use hostPath. Instead, a cluster administrator would provision a network resource, such as a GCE Persistent Disk volume, an NFS share, or an Amazon EBS volume. Network resources support the use of storage classes to set up dynamic provisioning.
1111

1212
A hostPath volume must be provisioned statically.
13+
14+
[IMPORTANT]
15+
====
16+
Do not mount to the container root, `/`, or any path that is the same in the host and the container. This can corrupt your host system if the container is sufficiently privileged. It is safe to mount the host by using `/host`. The following example shows the `/` directory from the host being mounted into the container at `/host`.
17+
18+
[source,yaml]
19+
----
20+
apiVersion: v1
21+
kind: Pod
22+
metadata:
23+
name: test-host-mount
24+
spec:
25+
containers:
26+
- image: registry.access.redhat.com/ubi8/ubi
27+
name: test-container
28+
command: ['sh', '-c', 'sleep 3600']
29+
volumeMounts:
30+
- mountPath: /host
31+
name: host-slash
32+
volumes:
33+
- name: host-slash
34+
hostPath:
35+
path: /
36+
type: ''
37+
----
38+
====

modules/persistent-storage-hostpath-pod.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ spec:
3737
----
3838
<1> The name of the pod.
3939
<2> The pod must run as privileged to access the node's storage.
40-
<3> The path to mount the hostPath share inside the privileged pod.
40+
<3> The path to mount the host path share inside the privileged pod. Do not mount to the container root, `/`, or any path that is the same in the host and the container. This can corrupt your host system if the container is sufficiently privileged, such as the host `/dev/pts` files. It is safe to mount the host by using `/host`.
4141
<4> The name of the `PersistentVolumeClaim` object that has been previously created.

modules/persistent-storage-hostpath-static-provisioning.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ A pod that uses a hostPath volume must be referenced by manual (static) provisio
3232
<1> The name of the volume. This name is how it is identified by persistent volume claims or pods.
3333
<2> Used to bind persistent volume claim requests to this persistent volume.
3434
<3> The volume can be mounted as `read-write` by a single node.
35-
<4> The configuration file specifies that the volume is at `/mnt/data` on the cluster's node.
35+
<4> The configuration file specifies that the volume is at `/mnt/data` on the cluster's node. Do not mount to the container root, `/`, or any path that is the same in the host and the container. This can corrupt your host system. It is safe to mount the host by using `/host`.
3636

3737
. Create the PV from the file:
3838
+

modules/persistent-storage-local-pod.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ spec:
3333
claimName: local-pvc-name <3>
3434
----
3535
<1> The name of the volume to mount.
36-
<2> The path inside the pod where the volume is mounted.
36+
<2> The path inside the pod where the volume is mounted. Do not mount to the container root, `/`, or any path that is the same in the host and the container. This can corrupt your host system if the container is sufficiently privileged, such as the host `/dev/pts` files. It is safe to mount the host by using `/host`.
3737
<3> The name of the existing persistent volume claim to use.
3838

3939
. Create the resource in the {product-title} cluster, specifying the file

modules/storage-persistent-storage-azure-file-pod.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ spec:
3333
claimName: claim1 <3>
3434
----
3535
<1> The name of the pod.
36-
<2> The path to mount the Azure File share inside the pod.
36+
<2> The path to mount the Azure File share inside the pod. Do not mount to the container root, `/`, or any path that is the same in the host and the container. This can corrupt your host system if the container is sufficiently privileged, such as the host `/dev/pts` files. It is safe to mount the host by using `/host`.
3737
<3> The name of the `PersistentVolumeClaim` object that has been previously created.

modules/storage-persistent-storage-pvc.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,6 @@ spec:
101101
persistentVolumeClaim:
102102
claimName: myclaim <3>
103103
----
104-
<1> Path to mount the volume inside the pod
105-
<2> Name of the volume to mount
106-
<3> Name of the PVC, that exists in the same namespace, to use
104+
<1> Path to mount the volume inside the pod.
105+
<2> Name of the volume to mount. Do not mount to the container root, `/`, or any path that is the same in the host and the container. This can corrupt your host system if the container is sufficiently privileged, such as the host `/dev/pts` files. It is safe to mount the host by using `/host`.
106+
<3> Name of the PVC, that exists in the same namespace, to use.

0 commit comments

Comments
 (0)