Accessing remote shell of a pod as root user

4/16/2019

I created a Jenkins persistent app using this template here. Now when a pod gets created and I want to access pod as a root user. But when I do oc rsh jenkins-mypod, it opens the pod as a default user. I want to open the pod as the root user. How can I do that?. I created this app under the developer account.

-- Rajat Singh
containers
jenkins
kubernetes
openshift

3 Answers

4/18/2019

Try using "kubectl ssh" plugin from here: https://github.com/jordanwilson230/kubectl-plugins

-- Vasily Angapov
Source: StackOverflow

4/24/2019

You can use a third-party tool kubectl-exec-user to achieve this. It does not require allowing sudo or any other privilege escalation mechanism in the container.

There is currently no built-in solution.

-- Shnatsel
Source: StackOverflow

4/16/2019

This is an opened issue in kubernetes https://github.com/kubernetes/kubernetes/issues/30656 so I don't think it's possible in openshift either.

-- Max Lobur
Source: StackOverflow