1

I have an angular application which is dockerized using nginx-alpine as base image. My infra is hosted on AKS cluster version 1.18.14 . And nginx-ingress to route traffic to pods k8s.gcr.io/ingress-nginx/controller:v0.44.0 . Below is my Ingress

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: ingress
  namespace: default
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
    nginx.ingress.kubernetes.io/use-regex: "true"
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
 rules:
  - http:
     paths:
      - path: /?(.*)
        backend:
        serviceName: portal
        servicePort: 80

When I hit the application with ip-address/ application loads . But If I want to add path to it with below nginx-ingress app doesn't load.

 - path: /myportal(/|$)(.*)
        backend:
          serviceName: my-portal
          servicePort: 80

WHen I hit ip-address/myportal app doesn't load. What changes should I make

niranjan pb
  • 1,125
  • 11
  • 14

1 Answers1

0

It looks like there is a mistake in your yaml config.

It should be:

  paths:
  - backend:
      serviceName: my-portal
      servicePort: 80
    path: /myportal(/|$)(.*)

instead of:

 - path: /myportal(/|$)(.*)
        backend:
          serviceName: my-portal
          servicePort: 80

Make sure the indentation are in place and syntax is correct. Use this example as a reference.

Wytrzymały Wiktor
  • 11,492
  • 5
  • 29
  • 37