Ingress controller nginx kubernetes not working

Hasni Mehdi

I facing a problem in an ingress controller nginx kubernetes that is deployed in minikube : when i included the route that nginx will use to redirect the request it didn't work , however when i remove the route it work : So , as is explained in yaml file when i use /category it didn't work , however with with just / it is working

---- load balancer ---
    apiVersion: extensions/v1beta1
    kind: Ingress
    metadata:
      name: spare-ingress-dev
      namespace: default
      annotations:
        kubernetes.io/ingress.class: nginx
        nginx.ingress.kubernetes.io/rewrite-target: /
    spec:
      rules:
         - http:
            paths:
              - path: /
                backend:
                  serviceName: cluster-test-ip
                  servicePort: 80
              - path: /category/
                backend:
                  serviceName: cluster-category-ip
                  servicePort: 5200

----service-----

    apiVersion: v1
    kind: Service
    metadata:
      name: cluster-category-ip
    spec:
      selector:
        app: category
      ports:
        - port: 5200
          targetPort: 5200
Hasni Mehdi
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: spare-ingress-dev
  namespace: default
  annotations:
     kubernetes.io/ingress.class: nginx
     nginx.ingress.kubernetes.io/use-regex: "true"
     nginx.ingress.kubernetes.io/app-root: /
spec:
 rules:
  - host: cluster.io
    http:
       paths:
        - path: /api/v1.0/auth/(.+)
          backend:
            serviceName: cluster-auth-ip
            servicePort: 6000
        - path: /api/v1.0/category/(.+)
          backend:
            serviceName: cluster-category-ip
            servicePort: 5200
        - path: /category/(.+)
          backend:
            serviceName: cluster-category-ip
            servicePort: 5200

i found the solution i removed nginx.ingress.kubernetes.io/rewrite-target: $1 and i added

kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/app-root: /

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

kubernetes ingress controller with cluster ip service and default nginx not working as expected

kubernetes nginx ingress controller rewrites

Kibana with nginx ingress controller in Kubernetes

Kubernetes Nginx Ingress Controller on NodePort

Kubernetes Nginx Ingress Controller expose Nginx Webserver

kubernetes nginx ingress controller / caching static assets

413 error with Kubernetes and Nginx ingress controller

How does an Nginx Ingress Controller work on Kubernetes?

kubernetes not creating the ELB for ingress-nginx controller

Nginx Ingress Controller Returns 404 Kubernetes

Nginx ingress controller without load balancer in Kubernetes

Redirection from http to https not working for custom backend service in Kubernetes Nginx Ingress Controller

SPA applications (Vue, React, Angular) not working properly behind Nginx ingress controller on Kubernetes

Kubernetes nginx ingress controller with multiple ingress resource objects

Kubernetes nginx-ingress ingress controller CORS handled by application

kubernetes nginx ingress // health checks not working

Kubernetes nginx Ingress configuration not working for Grafana

NGINX Ingress Controller not working on Amazon EKS

sticky sessions in nginx-ingress-controller not working

FastAPI docs not working with nginx Ingress controller

Kubernetes internal nginx ingress controller with SSL termination & ssl-passthrough

Nginx Ingress Controller can't find nodes on Google Kubernetes Engine

Kubernetes NGINX Ingress Controller not picking up TLS Certificates

How to use ConfigMap configuration with Helm NginX Ingress controller - Kubernetes

NGINX controller Kubernetes: need to change Host header within ingress

How can i create mutiple nginx ingress controller in kubernetes

Hosting webapp with relative URLs behind Kubernetes NGINX ingress controller

Want (internal) name for service while running nginx ingress controller kubernetes

How to expose localhost airflow with nginx-ingress-controller Kubernetes