0

I am setting up a k8s cluster using k3s. Currently I have a Jenkins pod running, set up according to this guide.

I have run into an issue setting up the kubernetes cluster for Jenkins workers I can't seem to get my head wrapped around:

If I go to my Jenkins pod and start the console to test that the JNLP is working, not all the different names I can use work:

curl localhost:50000 ✔ Works
curl `cat /etc/hostname`:50000 ✔ Works
curl jenkins-service:50000 ❌ Times out

BUT !!!

curl localhost:8080 ✔ Works
curl `cat /etc/hostname`:8080 ✔ Works
curl jenkins-service:8080 ✔ Works

I then went back to the YAML and took a look at it. Appart from there being more references to 8080 than 50000 (8080 is a part of several urls and liveliness checks and so on), I do not see anything amiss

      containers:
        ...
        ports:
        - containerPort: 8080
          name: httpport
          protocol: TCP
        - containerPort: 50000
          name: jnlpport
          protocol: TCP

I have looked at these defects and the issues seem to not be the same, causing me to think that it must be Kubernetes related.

1 Answer 1

0

I found a detailed guide which lead me to the answer...

In the service section only port 8080 was forwarded to 32000.

So I changed the service.yaml to be

apiVersion: v1
kind: Service
metadata:
  name: jenkins-service
  namespace: devops-tools
  annotations:
      prometheus.io/scrape: 'true'
      prometheus.io/path:   /
      prometheus.io/port:   '8080'
spec:
  selector:
    app: jenkins-server
  type: NodePort
  ports:
    - name: httpport
      port: 8080
      targetPort: 8080
      nodePort: 32000
    - name: jnlpport
      port: 50000
      targetPort: 50000

and executed kubectl apply -f service.yaml which seems to have had an immediate effect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.