- Create a minikube profile
# create
minikube start -p jenkins-minikube
# set as default profile
minikube profile jenkins-minikube
Optionally
minikube start -p minikube-jenkins --memory 8192 --cpus 2
- Create a namespace
kubectl create namespace jenkins
kubens jenkins
- Deploy Kubernetes manifests
kubectl apply -f ./kubernetes
- Navigate to jenkins using the minikube IP and service port
# minikube ip
minikube profile list
|------------------|-----------|---------|--------------|------|---------|---------|-------|
| Profile | VM Driver | Runtime | IP | Port | Version | Status | Nodes |
|------------------|-----------|---------|--------------|------|---------|---------|-------|
| minikube | hyperkit | docker | 112.132.61.2 | 8443 | v1.23.3 | Running | 1 |
| minikube-jenkins | hyperkit | docker | 181.134.24.7 | 8443 | v1.23.3 | Running | 1 |
|------------------|-----------|---------|--------------|------|---------|---------|-------|
# service port
kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
jenkins NodePort 10.108.176.124 <none> 8080:30408/TCP,50000:30707/TCP,80:30962/TCP 34m
# Navigate to
http://192.168.64.7:30408
You'll first need to create a credential set for the Jenkins controller to access the Minikube Kubernetes cluster. To do this, perform the following steps:
- In the Jenkins UI, click the Credentials link in the left-hand navigation pane
- Click the arrow next to (global) in the Stores scoped to Jenkins table (you have to hover next to the link to see the arrow)
- Click Add Credentials
- Under Kind, specify Kubernetes Service Account
- Leave the scope set to Global
- Click OK.
The next step is to create a cloud configuration for the minikube kubernetes cluster.
- In the Jenkins UI, go to Manage Jenkins → Manage Nodes and Clouds
- The following parameters must be set:
- Name: - This defaults to kubernetes.
- Kubernetes URL:
https://kubernetes.default
- This was automatically configured from the service account. - Kubernetes Namespace:
jenkins
. - Credentials:
~/.kube/config
→ Select the Kubernetes Service Account credentials you created in the previous step. - Jenkins URL:
http://<minikube-ip>:<service-port>
→http://192.168.64.7:30408
. - Jenkins tunnel:
<pod-ip>:<service-port>
→10.108.176.124:50000
- This is the port that is used to communicate with an agent.
The Jenkins data is stored in the minikube node, and can be accessed with SSH