kubernetes, Run bash script with user root when image exit with non-root user,

Viewed 35

I Have an image that exit with non root user consider image like

RUN <SCRIPT>
USER non-root

now in command & args section in k8s i need to run script with the root user.

something like.

        command:
          - sh
        args:
          - -c
          - apt-get update 

but as the IMAGE exit with non root user with limited privilege i got permission denied

NOTE: image also doesn't have sudo

ALSO normally after the build i can enter the container or pod as root user like

kubectl exec -it -u root <pod-id> -- bash 

but i don't need to run the script after the build i need to automate it while the build

0 Answers
Related