In this article we learn how  install Jenkins with Helm Charts  and  setting up Minikube to have routable Cluster IPs and External IPs

Installing the Chart

To install the chart with the release name my-release:

# helm install --name my-release stable/jenkins
NAME:   my-release
LAST DEPLOYED: Tue Dec 25 00:06:05 2018
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/ConfigMap
NAME                      DATA  AGE
my-release-jenkins        5     0s
my-release-jenkins-tests  1     0s

==> v1/PersistentVolumeClaim
NAME                STATUS   VOLUME    CAPACITY  ACCESS MODES STORAGECLASS  AGE
my-release-jenkins  Pending  standard  0s

==> v1/Service
NAME                      TYPE          CLUSTER-IP      EXTERNAL-IP  PORT(S)         AGE
my-release-jenkins-agent  ClusterIP     10.104.233.105  <none>       50000/TCP       0s
my-release-jenkins        LoadBalancer  10.110.225.156  <pending>    8080:31665/TCP  0s

==> v1/Deployment
NAME                DESIRED  CURRENT  UP-TO-DATE  AVAILABLE  AGE
my-release-jenkins  1        1        1           0          0s

==> v1/Pod(related)
NAME                                 READY  STATUS   RESTARTS  AGE
my-release-jenkins-67d7996f6d-sxrkj  0/1    Pending  0         0s

==> v1/Secret
NAME                TYPE    DATA  AGE
my-release-jenkins  Opaque  2     0s


NOTES:
1. Get your 'admin' user password by running:
  printf $(kubectl get secret --namespace default my-release-jenkins -o jsonpath="{.data.jenkins-admin-password}" | base64 --decode);echo
2. Get the Jenkins URL to visit by running these commands in the same shell:
  NOTE: It may take a few minutes for the LoadBalancer IP to be available.
        You can watch the status of by running 'kubectl get svc --namespace default -w my-release-jenkins'
  export SERVICE_IP=$(kubectl get svc --namespace default my-release-jenkins --template "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}")
  echo http://$SERVICE_IP:8080/login

    3. Login with the password from step 1 and the username: admin

For more information on running Jenkins on Kubernetes, visit:
    https://cloud.google.com/solutions/jenkins-on-container-engine

By default this installation run with one pods, you can scale for more in Replica Sets section as you see in next picture :

$ kubectl get svc --namespace default -w my-release-jenkins

Capture-d-e-cran-2018-12-25-a--01.53.18

As you see the The EXTERNAL-IP is always pending in minikube.

There are three solutions to get URL :

  1. Replace LoadBalancer Type  by NodePort, but it would be ideal if we could run those with no modifications on minikube.
  2. You can access  the service via the internal port 31665, but not the exposed. With get the external url to the service with command :
$ minikube service --url my-release-jenkins

Capture-d-e-cran-2018-12-25-a--02.01.39

# I get the URL : http://192.168.64.6:31665

Jenkins UI from service URL :

As indicated in the output of installation you get your 'admin' user password by running:

$ printf $(kubectl get secret --namespace default my-release-jenkins -o jsonpath="{.data.jenkins-admin-password}" | base64 --decode);echo

Capture-d-e-cran-2018-12-25-a--02.15.18

Or, from minikube Dashboard Config and Storage Secrets :

3.  One possible workaround is to install a custom controller that provisions an external IP using the service's ClusterIP, which must be made routable on the minikube host. These two commands accomplish this, and should be run once whenever you start a new minikube cluster:

$ sudo ip route add $(cat ~/.minikube/profiles/minikube/config.json | jq -r ".KubernetesConfig.ServiceCIDR") via $(minikube ip)
$ kubectl run minikube-lb-patch --replicas=1 --image=elsonrodriguez/minikube-lb-patch:0.1 --namespace=kube-system

# The Mac OS X terminal doesn't have ip for this use brew to install iproute2mac. It's actually a Python wrapper that provides a very similar API that you'll likely find very familiar to the ip tool included with iproute2 on Linux.
$ brew install iproute2mac
# The Mac OS X terminal doesn't have jq for this use too brew to install
$ brew install jq

Capture-d-e-cran-2018-12-25-a--05.14.47