You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Setting Pod Security Context to Container Runtime default
2
+
3
+
By default, the RabbitMQ Cluster Operator applies a [securityContext](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) in order to run the RabbitMQ container
4
+
and initContainer as a specific non-root user.
5
+
6
+
In some deployments, you may wish to remove this securityContext so that the containers are run with the default securityContext of the container runtime. For example, in Openshift, in order
7
+
to [run the RabbitMQ containers as an arbitrary user](https://www.openshift.com/blog/a-guide-to-openshift-and-uids), you will need to remove the operator-configured securityContext.
8
+
9
+
Note that unless your Kubernetes distribution applies a default securityContext to pods, your containers will run as root.
10
+
11
+
## Example
12
+
13
+
The example `rabbitmq.yaml` contains an override which will set the securityContext to the default, by specifying it as an empty struct (`{}`).
14
+
15
+
```shell
16
+
kubectl apply -f rabbitmq.yaml
17
+
```
18
+
19
+
You can then inspect the container to check that it is running with the default securityContext:
20
+
```shell
21
+
kubectl exec default-security-context-server-0 -- id
22
+
uid=0(root) gid=0(root) groups=0(root)
23
+
```
24
+
25
+
Or, in an environment where the runtime provides a default securityContext, like Openshift:
26
+
```shell
27
+
kubectl exec default-security-context-server-0 -- id
0 commit comments