Can't get angular 7 to route when deployed on a Kubernetes Ingress Path

2/28/2019

I am unable to get my Angular to Route after its deployed on via Kubernetes Ingress Path. It works in dev mode, it works when navigate to the service node port ip address, (xxx.xxx.xxx.xxx:pppp) but on the host.com/op. Example host.com/op/page - no routing to page.

Ingress:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ingress
  annotations:
    kubernetes.io/ingress.global-static-ip-name: [redacted]
spec:
  rules:
  - host: host.com
    http:
      paths:
      - path: /
        backend:
          serviceName:service-a
          servicePort: 80
      - path: /api/*
        backend:
          serviceName: service-b
          servicePort: 80
      - path: /op/*
        backend:
          serviceName: angular7-nginx-service
          servicePort: 80
  backend:
    serviceName: service-a
    servicePort: 80

My nginx server conf file

server {
  listen 80;
  charset utf-8;
  sendfile on;
  root /usr/share/nginx/html;

  location / {
    expires -1;
    add_header Pragma "no-cache";
    add_header Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0";

    try_files $uri $uri/ /index.html = 404;
  }

}
-- Michela Dennis
angular
kubernetes
kubernetes-ingress
nginx

0 Answers