Answers: <p>Try change the port number in <code>ingress.yaml</code> to <code>8080</code> as that is the port on which the <em>jenkins-service</em> service is available within the cluster. The <em>NodePort</em> is a port on the cluster nodes themselves which would hairpin the ingress traffic. <em>NodePort</em>s are meant for use with loadbalancing solutions external to the cluster.</p>
  <pre class="lang-yml prettyprint-override"><code>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
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2023-01-22T16:58:48.537Z
Answers: thanks for the suggestion. It didn't quite wrk as expected though (I have updated my question)
Answers: JoSSte
Answers: CC BY-SA 4.0
Answers: 2023-01-22T13:47:03.537Z
Answers: 2023-01-22T17:57:25.693Z
Answers: 2023-01-22T17:57:25.693Z
Answers: Roderick Bant
Body: <p>I have a Jenkins setup which is inspired by this guide.</p>
  <p>I wanted to add an url, so I added An ingress.yaml.
  jenkins is still available at &lt;node_url&gt;:32000 but not at <a href="http://jenkins.localdomain" rel="nofollow noreferrer">http://jenkins.localdomain</a> (where /etc/hosts has ) been updated with the IP of the node running Jenkins.
  What Am I missing?</p>
  <h2>$ cat ingress.yaml</h2>
  <pre class="lang-yaml prettyprint-override"><code>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
  </code></pre>
  <h2>$ cat service.yaml</h2>
  <pre class="lang-yml prettyprint-override"><code>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
  </code></pre>
  <h2>EDIT #1</h2>
  <p>I tried changing the port to 8080 as suggested, but portainer apparently doesn't like it (and it doesn't work)</p>
  <p>How it looks in the select service part of portainer's ingress page:<br />
  <a href="https://i.sstatic.net/MpsVm.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/MpsVm.png" alt="portainer edit ingress" /></a><br />
  How it looks in the select service part of portainer's service page:<br />
  <a href="https://i.sstatic.net/6Gjh1.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/6Gjh1.png" alt="portainer service" /></a></p>
  
Tags: <kubernetes><ingress>
Title: kubernetes ingress config for jenkins says service doesn't exist
UserDisplayName: JoSSte
ThreadText: # kubernetes ingress config for jenkins says service doesn't exist
  
  (Asked by: username_0 on 2023-01-21)
  
  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
  
  ```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
  
  ```yml
  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](https://i.sstatic.net/MpsVm.png)](https://i.sstatic.net/MpsVm.png)  
  How it looks in the select service part of portainer's service page:  
  [![portainer service](https://i.sstatic.net/6Gjh1.png)](https://i.sstatic.net/6Gjh1.png)
  
  **Tags:** kubernetes, ingress
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-01-22. Score: 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. *NodePort*s are meant for use with loadbalancing solutions external to the cluster.
  
  ```yml
  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
  
  ```
  
  > **Comments:**
  > **username_0**: thanks for the suggestion. It didn't quite wrk as expected though (I have updated my question)  
  
  ---
  
  