Kubernetes: Jenkins

Important: Notice the namespace I am using is itsmetommy throughout this document.

Clone git repository

https://github.com/itsmetommy/kubernetes-jenkins

Create

kubectl apply -f .
service/jenkins-master created
statefulset.apps/jenkins-master created

View

Method 1

It should be the first URL.

minikube -n itsmetommy service jenkins-master --url
http://192.168.99.100:31147
http://192.168.99.100:30011

Method 2

# view service
kubectl -n itsmetommy get services jenkins-master NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE jenkins-master NodePort 10.97.206.56 8080:31147/TCP,50000:30011/TCP 7m

# view minikube ip
minikube ip 192.168.99.100

Open browser

http://192.168.99.100:31147

You should see the unlock screen.

Password

Method 1

Get the logs from the pod.

kubectl -n itsmetommy logs jenkins-master-0
Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:
ddeb116312384717850691d0c51c985b
This may also be found at: /var/jenkins_home/secrets/initialAdminPassword

Method 2

cat the file from the pod.

kubectl -n itsmetommy exec jenkins-master-0 -- cat /var/jenkins_home/secrets/initialAdminPassword
ddeb116312384717850691d0c51c985b

Clean up

kubectl delete -f .
service "jenkins-master" deleted
statefulset.apps "jenkins-master" deleted

Delete pvc

kubectl -n itsmetommy delete pvc jenkins-master-home-jenkins-master-0
persistentvolumeclaim "jenkins-master-home-jenkins-master-0" deleted