0

I have a Jenkins setup which is inspired by this guide.

I wanted to add an url, so I added An ingress.yaml. jenkins is still available at <node_url>:32000 but not at http://jenkins.localdomain (where /etc/hosts has ) been updated with the IP of the node running Jenkins. What Am I missing?

$ cat ingress.yaml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: jenkins-ingress
  namespace: devops-tools
  annotations:
    traefik.ingress.kubernetes.io/router.entrypoints: 'websecure'
    traefik.ingress.kubernetes.io/router.tls: 'true'
spec:
  rules:
    - host: jenkins.localdomain
      http:
        paths:
          - pathType: Prefix
            path: /
            backend:
              service:
                name: jenkins-service
                port:
                  number: 32000

$ cat service.yaml

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

EDIT #1

I tried changing the port to 8080 as suggested, but portainer apparently doesn't like it (and it doesn't work)

How it looks in the select service part of portainer's ingress page:
portainer edit ingress
How it looks in the select service part of portainer's service page:
portainer service

1 Answer 1

1

Try change the port number in ingress.yaml to 8080 as that is the port on which the jenkins-service service is available within the cluster. The NodePort is a port on the cluster nodes themselves which would hairpin the ingress traffic. NodePorts are meant for use with loadbalancing solutions external to the cluster.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: jenkins-ingress
  namespace: devops-tools
  annotations:
    traefik.ingress.kubernetes.io/router.entrypoints: 'websecure'
    traefik.ingress.kubernetes.io/router.tls: 'true'
spec:
  rules:
    - host: jenkins.localdomain
      http:
        paths:
          - pathType: Prefix
            path: /
            backend:
              service:
                name: jenkins-service
                port:
                  number: 8080
1
  • thanks for the suggestion. It didn't quite wrk as expected though (I have updated my question)
    – JoSSte
    Jan 22, 2023 at 16:58

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.