Google Cloud Console Jenkins password

2/18/2019

I readed a lot of documentation. I setup a Jenkins on GCC using kubernetes default creation. When I go to enter, jenkins ask me about a password to unlock. Im unable to find that password.

Thanks

-- Arturo
google-cloud-platform
jenkins
kubernetes

4 Answers

2/18/2019

For GKE Marketplace "click to deployment" Jenkins, instruction is pretty simple, and can be found in the application "Next steps" Description part after deployment:

Access Jenkins instance.

Identify HTTPS endpoint.

echo https://$(kubectl -njenkins get ingress -l "app.kubernetes.io/name=jenkins-1" -ojsonpath="{.items[0].status.loadBalancer.ingress[0].ip}")/

For HTTPS you have to accept a certificate (we created a temporary one for you).
Now you need a password.

kubectl -njenkins exec \
  $(kubectl -njenkins get pod -oname | sed -n /\\/jenkins-1-jenkins-deployment/s.pods\\?/..p) \
  cat /var/jenkins_home/secrets/initialAdminPassword

To fully configure Jenkins instance follow on screen instructions.

I've tested it and it works as expected.

Another guide with almost the same steps can be found here

Jenkins docker image usually shows the initial password in the container log.

-- VAS
Source: StackOverflow

2/18/2019

the password will be in a file under folder /secrects/initialadminpassword.

You can go inside the container in case volume mapping is not done

-- error404
Source: StackOverflow

2/18/2019

I've had the same issue when creating a jenkins on a gke cluster and I couldn't even found the initialAdminPassword (tried to look inside the volume with no chances)...

As I was looking to have authentication on the cluster, I just created my own image with the google oauth plugin and a groovy file using this repo as a model: https://github.com/Sho2010/jenkins-google-login

This way when connecting I can use my google account. If you need other auth method, you should be able to found them on the net.

In the case you just want to test Jenkins and you don't need a password use the JAVA_OPTS without running the setup like this:

- name: JAVA_OPTS
  value: -Xmx4096m -Djenkins.install.runSetupWizard=false

If you are using the basic jenkins image you shouldn't have any password and have full access to your jenkins (Don't live it like this if you are going to create production ready jobs)

-- night-gold
Source: StackOverflow

5/28/2020

Access the Jenkins container via cloud shell.

Get fist get the pod id :

kubectl get pods --namespace=yourNamespace
jenkins-867df9fcb8-ctfq5         1/1     Running   0          16m

Then execute a bash on the pod Id :

kubectl exec -it --namespace=yourNamespace jenkins-867df9fcb8-ctfq5 -- bash

Then just cd to the directory where the initialAdminPassword is saved and use the "cat" command to print its value.

-- Maarten Dekker
Source: StackOverflow