Fixing PodSecurity Admission warnings for deployments

Solution Verified - Updated -


  • Why I am receiving warnings related to Pod Security even though the deployment is running with restricted-v2 SCC?
$ oc  create deployment hello-node -- /agnhost serve-hostname
Warning: would violate PodSecurity "restricted:v1.24": allowPrivilegeEscalation != false (container "agnhost" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities (container "agnhost" must set securityContext.capabilities.drop=["ALL"]), runAsNonRoot != true (pod or container "agnhost" must set securityContext.runAsNonRoot=true), seccompProfile (pod or container "agnhost" must set securityContext.seccompProfile.type to "RuntimeDefault" or "Localhost")
deployment.apps/hello-node created
$ oc describe pod hello-node-855787d74c-h99pg | grep scc
  • Such warnings could be seen for pods running inside openshift-operators namespace as well.


  • Red Hat OpenShift Container Platform 4.11+

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content