{"id":1649,"date":"2021-10-17T15:40:05","date_gmt":"2021-10-17T15:40:05","guid":{"rendered":"https:\/\/the-plot.com\/blog\/?p=1649"},"modified":"2021-10-23T17:22:10","modified_gmt":"2021-10-23T17:22:10","slug":"jenkins-container-on-kubernetes","status":"publish","type":"post","link":"https:\/\/the-plot.com\/blog\/?p=1649","title":{"rendered":"Jenkins Container on Kubernetes"},"content":{"rendered":"\n<p>For ease of deployment, but without wanting to dive straight into Helm (just yet), I decided to try to stand up a very simple \/ crude Kubernetes deployment based on Jenkins. Needless to say, it wasn&#8217;t as simple as I&#8217;d hoped: I ran into a number of permission related problems.<\/p>\n\n\n\n<p>On first pass, I got a log message which said that the Jenkins didn&#8217;t have permission to write to \/var\/jenkins_home\/copy_reference_file.log. <a href=\"https:\/\/stackoverflow.com\/questions\/44065827\/jenkins-wrong-volume-permissions\">This post<\/a> suggested a quick and easy fix, which was to run the container as root. This translates to a runAsUser 0 in a securityContext definition. And, per the recommendation (which includes caveats), the permission problem went away. While the pod started correctly, I then started having persistent problems with the connection refused, even when I tried on localhost from within the container. I suspected (possibly incorrectly) this was related to the root perms, so based on <a href=\"https:\/\/github.com\/jenkinsci\/docker\/issues\/493\">this issue<\/a>, removed the block, deleted everything under the persistent volume that was already installed, and chown&#8217;ed to 1000 (which is the ubuntu user). This fixed the perms problem, but I was still getting a connection refused.<\/p>\n\n\n\n<p>What I suspect was the problem was that I was trying to map a loadBalancer service definition onto port 80, which the non-privileged user 1000 didn&#8217;t have perms for. Changing this to the default of 8080 worked. <a href=\"https:\/\/github.com\/zogspat\/microk8s\/blob\/main\/jenkinsWithNFS.yaml\">This is the working spec<\/a>. I&#8217;m slightly suspicious about the use of the environment variable for the volume but, as I say, it works.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For ease of deployment, but without wanting to dive straight into Helm (just yet), I decided to try to stand up a very simple \/ crude Kubernetes deployment based on Jenkins. Needless to say, it wasn&#8217;t as simple as I&#8217;d &hellip; <a href=\"https:\/\/the-plot.com\/blog\/?p=1649\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,5],"tags":[],"class_list":["post-1649","post","type-post","status-publish","format-standard","hentry","category-cloud","category-tech"],"_links":{"self":[{"href":"https:\/\/the-plot.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1649","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/the-plot.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/the-plot.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/the-plot.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/the-plot.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1649"}],"version-history":[{"count":1,"href":"https:\/\/the-plot.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1649\/revisions"}],"predecessor-version":[{"id":1650,"href":"https:\/\/the-plot.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1649\/revisions\/1650"}],"wp:attachment":[{"href":"https:\/\/the-plot.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1649"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/the-plot.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1649"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/the-plot.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1649"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}