Using Minikube & Helm to create a local Jenkins server on your mac
Walking through how to install Minikube and Helm on a Mac. Once installed, we will create a local Jenkins server. This post is meant to be simple and straight forward for beginners.
Pre-Reqs for Success
- Install Virtual Box
- verify a version is installed by running
virtualbox --help
from the command line to see the version installed
- verify a version is installed by running
- On your mac device
brew install helm
brew install minikube
brew install kubectl
Getting Started
Start minikube from the command line by running:
minikube start -driver=virtualbox
minikube status
You should see something like:
There is a site that is being hosted locally now, to go to the site run:
minikube dashboard
Use helm to download the Jenkins Image
With helm 3.0, we need to add the source repo in order for our search for stable images to work:
helm repo add stable https://kubernetes-charts.storage.googleapis.com/
Then search for the Jenkins image:
helm search jenkins
We should now see:
Next, install the stable image (note we are specifying the name be jenkins in helm vs. a random generated name)
helm install jenkins stable/jenkins
This output is important because it is going to tell us what our default jenkins password is
So lets run:
printf $(kubectl get secret --namespace default jenkins -o jsonpath="{.data.jenkins-admin-password}" | base64 --decode);echo
In this case, the admin password is: cJJG4wV1Q
The virtual box instance is hosting our Kubernetes front end.
We can also see our pod out in minikube as well:
Connecting to Jenkins
Next we will set up how we will connect to Jenkins, using Port forwarding
The output from helm install also sets up an environment variable for the pod name and it gives us the commands to run to get to our Jenkins instance:
export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/component=jenkins-master" -l "app.kubernetes.io/instance=jenkins" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace default port-forward $POD_NAME 8080:8080
This will allow us to hit our Jenkins front end at http://127.0.0.1:8080
after running these commands
The default username is admin and use the default password above. The password can be changed in the configuration files prior to deployment or after in the Jenkins UI itself.
You can stop and start minikube, and subsequently Jenkins anytime you want.
Customize it
This post covers beginner content to get you started. Once you feel more comfortable, you can customize many configurations like plugins, users, passwords and libraries just to name a few.