An Interest In:
Web News this Week
- April 19, 2024
- April 18, 2024
- April 17, 2024
- April 16, 2024
- April 15, 2024
- April 14, 2024
- April 13, 2024
February 29, 2020 05:58 pm GMT
Original Link: https://dev.to/techworld_with_nana/run-pod-with-root-privileges-41n9
Run Kubernetes Pod with root privileges
Problem:
Most Docker containers and the processes inside run with non-root user, because of better security. If the container process is running with root (uid 0) it will be the same root as on the host. In this case user may get access to host from the container, thus gaining the root privilege on the host. This is of course a security concern.
However there can be a case when you need to run a container with root privilege because of permission issues of the volumes on the host.
Solution:
In order to run a container inside a pod with root, add following config:
apiVersion: extensions/v1beta1kind: Deploymentmetadata: name: my-appspec: template: spec: containers: - image: my-image name: my-app ... securityContext: allowPrivilegeEscalation: false runAsUser: 0
Now when you enter the 'my-image' container with docker exec
or kubectl exec
, you will see that the user is root.
FREE Docker & Kubernetes course
I'm happy to connect with you on
Original Link: https://dev.to/techworld_with_nana/run-pod-with-root-privileges-41n9
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To