Jenkins on StackOS

Jenkins app deployment from the StackOS AppStore.

Jenkins is a tool used by developers to automate various processes.

We will show how a basic setup can fail, how to discover the failure, and how to fix the failure.

References

✅ First Launch

Use this image: jenkins/jenkins:lts-jdk11

✅ Initial Setup Results

After your initial setup you will be presented with a URL such as:

https://jenkins-0xyourethaddress-matrix.stackos.io/

✅ Seeing your first failure

Navigate to the provided URL to see the following message

no healthy upstream

✅ Checking Failure

pageWebTTY, Logs, Shell Access

Open a WebTTY and list your pod statuses

You will see that your Jenkins pod is flagged with "CrashLoopBackOff"

This indicates your pod is crashing

✅ Determine Nature of Crash

Use the WebTTY to show the pod logs. In some cases you will see something, in other cases you will not. It depends on the method used to set up the docker image.

kubectl logs jenkins-0xYourEthAddress

We have now determined our persistent data is owned by the wrong user. This is common if the pod is running as a user other than root. Determine the owner of the directory, set the ownership properly, and restart.

✅ Determining Owner

Navigate to the image details https://hub.docker.com/layers/jenkins/jenkins/latest/images/sha256-aa593c851bdd8ca16c7e546d2fbb191e3dd6bdb960a464b1f844d80431c272ef?context=explore

We now know the user/group should be 1000 / 1000 respectively.

✅ Changing Ownership

We use a dummy container image to make an easy shell and change ownership of the data directory

Temporarily set your pod image to "nginx:latest" and Update your Application

Shell into your pod

kubectl exec -ti jenkins-0xYourEthAddress-Random -- bash

Change the ownership of the persistent data directory

chmod 1000:1000 /var/jenkins_home

Verify the new ownership

# ls -al /var/jenkins_home
total 28
drwxr-xr-x 3 1000 1000  4096 Mar 18 13:29 .
drwxr-xr-x 1 root root  4096 Mar 18 13:45 ..
drwx------ 2 root root 16384 Mar 18 13:29 lost+found

Change the image back to jenkins/jenkins:lts-jdk11

✅ Success

Jenkins is now running!

✅ Obtain your setup password

kubectl exec jenkins-0xYourEthAddress-random more /var/jenkins_home/secrets/initialAdminPassword

Fill in the password

Proceed through the installation steps. We recommend you take the basic route the first time to get familiar before doing more complex setups.

Your site is now ready:

Last updated