minio-operator installation failed, PodSecurity violation, OKD 4.15
Hi,
Current Behavior
I am configuring a disconnected / air-gap OKD 4.15 production cluster.
I'm trying to install min.io-operator but not thru the OpenShift OperatorHub/Marketplace hence following instructions from upstream. The installation failed, these are the errors:
Warning: would violate PodSecurity "restricted:v1.24": allowPrivilegeEscalation != false (container "minio-operator" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities (container "minio-operator" must set securityContext.capabilities.drop=["ALL"]), seccompProfile (pod or container "minio-operator" must set securityContext.seccompProfile.type to "RuntimeDefault" or "Localhost") Warning: would violate PodSecurity "restricted:v1.24": allowPrivilegeEscalation != false (container "console" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities (container "console" must set securityContext.capabilities.drop=["ALL"]), seccompProfile (pod or container "console" must set securityContext.seccompProfile.type to "RuntimeDefault" or "Localhost")
when I checked: oc get deployment minio-operator errors as follows:
'pods "minio-operator-5c477597c8-" is forbidden: unable to validate against any security context constraint: [provider "anyuid": Forbidden: not usable by user or serviceaccount, provider restricted-v2: .containers[0].runAsUser: Invalid value: 1000: must be in the ranges: [1000700000, 1000709999], provider "restricted": Forbidden: not usable by user or serviceaccount, provider "nonroot-v2": Forbidden: not usable by user or serviceaccount, provider "nonroot": Forbidden: not usable by user or serviceaccount, provider "hostmount-anyuid": Forbidden: not usable by user or serviceaccount, provider "machine-api-termination-handler": Forbidden: not usable by user or serviceaccount, provider "hostnetwork-v2": Forbidden: not usable by user or serviceaccount, provider "hostnetwork": Forbidden: not usable by user or serviceaccount, provider "hostaccess": Forbidden: not usable by user or serviceaccount, provider "node-exporter": Forbidden: not usable by user or serviceaccount, provider "privileged": Forbidden: not usable by user or serviceaccount]
The current status of the deployments:
I've tried installing both using krew and helm.
Possible Solution
I understand new in version Operator: 5.0.6 For Kubernetes 1.25.0 and later, MinIO supports deploying in environments with the Pod Security admission (PSA) restricted policy enabled.
In direct-pv installation, it was required to add service account by adding system:serviceaccount:directpv:directpv-min-io to users in oc edit scc privileged, i'm thinking I should also add a service account for minio-operator in the same way?
how do I remediate this?
Thank you.
Deployment information:
oc minio version: Kubectl-Plugin Version: v5.0.14 Installed DirectPV version: directpv version v4.0.10 OKD Cluster Version: 4.15.0-0.okd-2024-03-10-010116 Kernel version: v1.28.2-3598+6e2789bbd58938-dirty
I tried retrieving the pod definition of minio-operator-5c477597c8- thrown in the error stack but can't be found.
I understand that you're not installing the operator via OpenShift Marketplace, but are you using the Helm charts? We have very recently updated our Helm charts and the Minio operator to provide out-of-the-box support to run with restricted pod security standards (https://github.com/minio/operator/pull/2072). This version hasn't been released yet.
Until the new Helm charts and operator are released, you may want to add the following values to your values.yaml file (that specifies the custom values for your deployment). Add the following values for the operator:
operator:
containerSecurityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
seccompProfile:
type: RuntimeDefault
console:
containerSecurityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
seccompProfile:
type: RuntimeDefault
Add the following for tenants that are deployed via Helm to the tenant.pools[*].containerSecurityContext value(s):
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
seccompProfile:
type: RuntimeDefault
If you use the operator console to deploy tenants, then you can create the tenant and after deployment (that fails), you can use kubectl edit tenant -n <namespace> <tenant-name> to add the security context to the pool containers.
The error regarding Invalid value: 1000: must be in the ranges: [1000700000, 1000709999] is not known to me, but I've seen reports (from other Kubernetes operators) that user ID 1000 is not accepted by OpenShift in restricted environments. You may want to change that too in the values.yaml file, so it will look like this (also includes the changes from the previous comment):
operator:
securityContext:
runAsUser: 1000700000
containerSecurityContext:
runAsUser: 1000700000
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
seccompProfile:
type: RuntimeDefault
console:
securityContext:
runAsUser: 1000700000
containerSecurityContext:
runAsUser: 1000700000
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
seccompProfile:
type: RuntimeDefault
For the tenants you may also override the runAsUser in the tenant.pools[*].securityContext.runAsUser and tenant.pools[*].containerSecurityContext.runAsUser fields.
I also saw other "accepted" ranges from OpenShift like [1000000000, 1000009999], so the actual valid range isn't predictable and we cannot generate a proper "default" value. Could you please try to update the runAsUser values to a value within the range and let me know if that solves that issue?
Hi @ramondeklein, thanks for your prompt reply.
Added account in oc edit scc privileged solved the error.