I am trying to remove privileged mode from init container, when i set to priviliged: false. I am getting above error. I had set readOnlyRootFilesystem: false and lines below at the pod securityContext level
securityContext:
sysctls:
- name: net.ipv4.ip_local_port_range
value: 0 65535
The problem is that you cannot run
sysctlwithout the privileged mode due to security reasons. This is expected since docker restricts access to/procand/sys.In order for this to work you need to use the privileged mode for the init container and than either:
securityContextfor a Pod. For example:sysctlscan be set in pods by specifying lists ofsysctlsorsysctlpatterns in theforbiddenSysctlsand/orallowedUnsafeSysctlsfields of thePodSecurityPolicy. For example:Notice that:
sysctlson a container-local basis withdocker run --sysctl.I also recommend going through the whole linked documentation as caution is advised because use of unsafe
sysctlsis at-your-own-risk and can lead to severe problems like wrong behavior of containers, resource shortage or complete breakage of a node.