The following is part of a series of posts called "Repurposing old equipment by building a Kubernetes cluster".
While old equipment by itself is in general not very useful unless you find a particular use case, by combining a number of old devices you can build a more powerful system that can span perhaps a number of use cases. Kubernetes is a perfect candidate to be able to do this. I had a number of old laptops laying about and decided to test this theory out.
Use cases for a cluster made up of old equipment such as what I’ve built so far definitely does not include mission critical, production based tasks.
One definite use case though is your own (or your companies) CI/CD system. The costs associated with such systems is typically pretty high compared to the use they get and the higher than required uptime / SLA that come with most cloud servers these days.
Jenkins is obviously the clear choice here, so I install it via Helm with the following:
$ helm install --name jenkins stable/jenkins --set master.serviceType=ClusterIP
NAME: jenkins
LAST DEPLOYED: Thu Sep 5 18:46:41 2019
NAMESPACE: default
STATUS: DEPLOYED
RESOURCES:
==> v1/ConfigMap
NAME DATA AGE
jenkins 5 2s
jenkins-tests 1 2s
==> v1/Deployment
NAME READY UP-TO-DATE AVAILABLE AGE
jenkins 0/1 1 0 1s
==> v1/PersistentVolumeClaim
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
jenkins Bound pvc-34f5a881-8f72-428c-a40e-523b0192f283 8Gi RWO nfs-sc 2s
==> v1/Pod(related)
NAME READY STATUS RESTARTS AGE
jenkins-6f7b667cd5-5n8hv 0/1 Init:0/1 0 1s
==> v1/Role
NAME AGE
jenkins-schedule-agents 2s
==> v1/RoleBinding
NAME AGE
jenkins-schedule-agents 1s
==> v1/Secret
NAME TYPE DATA AGE
jenkins Opaque 2 2s
==> v1/Service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
jenkins ClusterIP 10.101.45.203 <none> 8080/TCP 1s
jenkins-agent ClusterIP 10.103.178.0 <none> 50000/TCP 1s
==> v1/ServiceAccount
NAME SECRETS AGE
jenkins 1 2s
NOTES:
1. Get your 'admin' user password by running:
printf $(kubectl get secret --namespace default 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:
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}")
echo http://127.0.0.1:8080
kubectl --namespace default port-forward $POD_NAME 8080:8080
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
I now forward the port for the current pod
$ kubectl port-forward jenkins-6f7b667cd5-5n8hv 8080:8080
Forwarding from 127.0.0.1:8080 -> 8080
Forwarding from [::1]:8080 -> 8080
And then visit http://localhost:8080
and Jenkins login screen appears. Fantastic!
Another example of how easy Kubernetes and Helm make things. You couldn’t deploy a scalable version of Jenkins much quicker than what I just did.