nginx ingress issue - nexus jenkins sornaqube

devops

Well-known member
  • Apr 3, 2023
    631
    473
    63
    colombo
    I have a K3s cluster (local) and am trying to access Jenkins, SonarQube, and Nexus through Nginx Ingress at specific paths.
    like > ( devopstools.com/jenkins, devopstools.com/nexus, devopstools.com/sonarqube ).

    However, these tools are not fully loading when accessed through Ingress.

    Has anyone faced a similar issue or has suggestions on how to fix this?

    This is my current Nginx Ingress configuration:

    Code:
    /etc/hosts
    
    127.0.0.1    localhost
    127.0.1.1    ubuntu
    
    # The following lines are desirable for IPv6 capable hosts
    ::1     ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    ff00::0 ip6-mcastprefix
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters
    192.168.8.113 devopstools.com

    YAML:
    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: jenkins-ingress
      namespace: jenkins-ns
      annotations:
        nginx.ingress.kubernetes.io/rewrite-target: /
    spec:
      ingressClassName: nginx
      rules:
      - host: devopstools.com
        http:
          paths:
          - path: /jenkins
            pathType: Prefix
            backend:
              service:
                name: my-jenkins
                port:
                  number: 8080
    
    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: sonarqube-ingress
      namespace: sonarqube-ns
      annotations:
        nginx.ingress.kubernetes.io/rewrite-target: /
    spec:
      ingressClassName: nginx
      rules:
      - host: devopstools.com
        http:
          paths:
          - path: /sonarqube
            pathType: Prefix
            backend:
              service:
                name: my-sonarqube-sonarqube
                port:
                  number: 9000
    
    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: nexus-ingress
      namespace: nexus-ns
      annotations:
        nginx.ingress.kubernetes.io/rewrite-target: /
    spec:
      ingressClassName: nginx
      rules:
      - host: devopstools.com
        http:
          paths:
          - path: /nexus
            pathType: Prefix
            backend:
              service:
                name: nexus-service
                port:
                  number: 8081
     

    Attachments

    • Screenshot from 2025-02-22 16-46-07.png
      Screenshot from 2025-02-22 16-46-07.png
      67.7 KB · Views: 68
    • Like
    Reactions: NRTG and LZP1992

    LZP1992

    Well-known member
  • Feb 6, 2014
    5,636
    5,942
    113
    @ගෙදර
    Mehma seen ekak mata wuna aws ec2 ekaka host karala docker wala nam...
    mn kare security group wala ingress ip set eka 8000-9000 range eka dunna eka.Passe awla hari giya.
     
    • Like
    Reactions: NRTG

    0x9

    Well-known member
  • Mar 18, 2015
    541
    836
    93
    I have a K3s cluster (local) and am trying to access Jenkins, SonarQube, and Nexus through Nginx Ingress at specific paths.
    like > ( devopstools.com/jenkins, devopstools.com/nexus, devopstools.com/sonarqube ).

    However, these tools are not fully loading when accessed through Ingress.

    Has anyone faced a similar issue or has suggestions on how to fix this?

    This is my current Nginx Ingress configuration:

    Code:
    /etc/hosts
    
    127.0.0.1    localhost
    127.0.1.1    ubuntu
    
    # The following lines are desirable for IPv6 capable hosts
    ::1     ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    ff00::0 ip6-mcastprefix
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters
    192.168.8.113 devopstools.com

    YAML:
    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: jenkins-ingress
      namespace: jenkins-ns
      annotations:
        nginx.ingress.kubernetes.io/rewrite-target: /
    spec:
      ingressClassName: nginx
      rules:
      - host: devopstools.com
        http:
          paths:
          - path: /jenkins
            pathType: Prefix
            backend:
              service:
                name: my-jenkins
                port:
                  number: 8080
    
    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: sonarqube-ingress
      namespace: sonarqube-ns
      annotations:
        nginx.ingress.kubernetes.io/rewrite-target: /
    spec:
      ingressClassName: nginx
      rules:
      - host: devopstools.com
        http:
          paths:
          - path: /sonarqube
            pathType: Prefix
            backend:
              service:
                name: my-sonarqube-sonarqube
                port:
                  number: 9000
    
    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: nexus-ingress
      namespace: nexus-ns
      annotations:
        nginx.ingress.kubernetes.io/rewrite-target: /
    spec:
      ingressClassName: nginx
      rules:
      - host: devopstools.com
        http:
          paths:
          - path: /nexus
            pathType: Prefix
            backend:
              service:
                name: nexus-service
                port:
                  number: 8081
    browser එකේ network tab එකේ errors මොනවත් එනවද ? අනෙත් එක K8s services definitions ටිකක් දාන්න port mapping ගැන idea එකක් ගන්න
     
    • Like
    Reactions: LZP1992 and NRTG

    msan

    Well-known member
  • Oct 17, 2017
    248
    251
    63
    Oya danta DevOps karana ekenkda?

    Podak website wada karana hari balagena, thaniyen solve karaganna balanna. Oyage full setup eka api danneh na neh.
     
    • Like
    Reactions: devops and NRTG

    devops

    Well-known member
  • Apr 3, 2023
    631
    473
    63
    colombo
    browser එකේ network tab එකේ errors මොනවත් එනවද ? අනෙත් එක K8s services definitions ටිකක් දාන්න port mapping ගැන idea එකක් ගන්න
    Code:
    NAME                                       TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
    nexus-service                              ClusterIP   10.43.31.174   <none>        8081/TCP         13d
    nexus-service-for-docker-hosted-registry   NodePort    10.43.188.83   <none>        8085:30085/TCP   10d
    
    NAME               TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)     AGE
    my-jenkins         ClusterIP   10.43.52.170   <none>        8080/TCP    10d
    my-jenkins-agent   ClusterIP   10.43.86.37    <none>        50000/TCP   10d
    
    NAME                               TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)    AGE
    my-sonarqube-postgresql            ClusterIP   10.43.215.96   <none>        5432/TCP   14d
    my-sonarqube-postgresql-headless   ClusterIP   None           <none>        5432/TCP   14d
    my-sonarqube-sonarqube             ClusterIP   10.43.99.119   <none>        9000/TCP   14d
     

    0x9

    Well-known member
  • Mar 18, 2015
    541
    836
    93
    Code:
    NAME                                       TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
    nexus-service                              ClusterIP   10.43.31.174   <none>        8081/TCP         13d
    nexus-service-for-docker-hosted-registry   NodePort    10.43.188.83   <none>        8085:30085/TCP   10d
    
    NAME               TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)     AGE
    my-jenkins         ClusterIP   10.43.52.170   <none>        8080/TCP    10d
    my-jenkins-agent   ClusterIP   10.43.86.37    <none>        50000/TCP   10d
    
    NAME                               TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)    AGE
    my-sonarqube-postgresql            ClusterIP   10.43.215.96   <none>        5432/TCP   14d
    my-sonarqube-postgresql-headless   ClusterIP   None           <none>        5432/TCP   14d
    my-sonarqube-sonarqube             ClusterIP   10.43.99.119   <none>        9000/TCP   14d
    port mapping නම් අව්ලක් නෑ වගේ.. මේ suffix 3ට විතර අවුල එන්නේ? නැත්න්ම හැම service එකක්ම එහෙමද ? Ingress controller එකේ logs වල clue එකක් නැද්ද? එකෙත් අවුලක් නැත්නම් network tab එකෙන් activity වලින් idea එකක් ගන්න පුළුවන්නේ

    මම නම් local k8s setup එක විදියට minikube + istio ingress තමයි use කරන්නේ... මම k3s නම් use කරලා නෑ ටිකක් unsuitable කියල තමයි අහල තියෙන්නේ
     
    • Like
    Reactions: NRTG

    LZP1992

    Well-known member
  • Feb 6, 2014
    5,636
    5,942
    113
    @ගෙදර
    port mapping නම් අව්ලක් නෑ වගේ.. මේ suffix 3ට විතර අවුල එන්නේ? නැත්න්ම හැම service එකක්ම එහෙමද ? Ingress controller එකේ logs වල clue එකක් නැද්ද? එකෙත් අවුලක් නැත්නම් network tab එකෙන් activity වලින් idea එකක් ගන්න පුළුවන්නේ

    මම නම් local k8s setup එක විදියට minikube + istio ingress තමයි use කරන්නේ... මම k3s නම් use කරලා නෑ ටිකක් unsuitable කියල තමයි අහල තියෙන්නේ
    Machn local minicube + istio setup karagnna ram eka kochchra oneda?
     
    • Like
    Reactions: NRTG and 0x9

    0x9

    Well-known member
  • Mar 18, 2015
    541
    836
    93
    Machn local minicube + istio setup karagnna ram eka kochchra oneda?
    minikube වලට minimum 8 GB allocate කරන්න ඕන මචන් istio හරියට up වෙන්න නම් ... මම minikube start කරන්නේ " --cpus=4 --memory=8192mb " config එකෙන්... total ram එක නම් 24-32 GB වගේ ඕන smoothly වැඩ කරන්න
     
    • Sad
    • Like
    Reactions: LZP1992 and NRTG

    devops

    Well-known member
  • Apr 3, 2023
    631
    473
    63
    colombo
    Thanks for your help! ❤️

    I found that some applications may not support path-based routing properly.

    Because of this, I decided to go with host-based routing instead, using subdomains like jenkins.devopstools.com and sonarqube.devopstools.com.
     
    • Love
    • Like
    Reactions: 0x9 and LZP1992