I do understand drawbacks of doing this, however I have image that will work only with root user running cmd within it.
Server kubernetes version is: v1.19.14
.
Inside my deployment.yaml
I have:
spec:
containers:
- name: myapp
securityContext:
allowPrivilegeEscalation: false
runAsUser: 0
command: ...
image:...
But when I describe rs
I see following:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedCreate 0s (x13 over 21s) replicaset-controller Error creating: pods "myapp-7cdd994c56-" is forbidden: PodSecurityPolicy: unable to admit pod: [spec.containers[0].securityContext.runAsUser: Invalid value: 0: running with the root UID is forbidden]
What do I do wrong?