Similar option for docker exec -u <USER> in openshift

7/21/2018

I have a Jenkins pod running in OpenShift.

I have enabled anyuid for my project as per http://appagile.io/2017/03/29/how-to-run-a-pod-as-root/.

However, I'm unable to get the initial admin password due to the following issue

<html><head><meta http-equiv='refresh' content='1;url=/login?from=%2F'                  /><script>window.location.replace('/login?from=%2F');</script></head><body     style='background-color:white; color:white;'>


Authentication required
<!--
You are authenticated as: anonymous
Groups that you are in:

 Permission you need to have (but didn't): hudson.model.Hudson.Read
 ... which is implied by: hudson.security.Permission.GenericRead
 ... which is implied by: hudson.model.Hudson.Administer
-->

As per the solution mentioned in this - https://stackoverflow.com/a/41055670

I tried adding jenkins user as part of root.

sudo usermod -a -G root jenkins

But sudo package was not installed in the Jenkins pod. I tried su -i but it's asking for root password which I don't know.

In Docker, I use docker exec -u root option to log in as root. But I don't see any such option in oc. Are there any other option we can try to resolve this issue?

-- smc
jenkins
kubernetes
openshift
openshift-client-tools
openshift-enterprise

0 Answers