<p>I'm currently trying to setup a react SPA as a deployment/service on kubernetes. Like the backend services I have running currently, I want to be able to hit it behind an Ingress. </p>

<p>Because the SPA is just a bunch of static files, I'm exposing the files through nginx. The container that runs in the deployment has nginx installed to serve the static assets (<code>nginx -g  daemon off</code> in the docker file). This works completely fine if I expose the deployment with a <code>LoadBalancer</code>, but if I use an Ingress, I get no response. Are there any special things to consider when serving static assets behind an ingress? Or any known references/resources for doing this?</p>

<p>Here's my ingress.yml:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: web-ingress
  annotations:
    kubernetes.io/ingress.global-static-ip-name: web-static-ip
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  rules:
  - host: api.my-domain.com
    http:
      paths:
        - backend:
            serviceName: web-backend-service
            servicePort: 80
  - host: app.my-domain.com
    http:
      paths:
        - backend:
            serviceName: web-frontend-service
            servicePort: 80
</code></pre>

Jay K.
<p><strong>You need to have an ingress controller deployed on your cluster for an ingress resource to actually take effect</strong>. Here is the <a href="https://kubernetes.github.io/ingress-nginx/deploy/" rel="noreferrer">installation guide</a> of Nginx ingress controller.An example ingress to serve static content would look like below.</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: web-ingress
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/add-base-url: "true"
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - host: api.my-domain.com
    http:
      paths:
        - backend:
            serviceName: web-backend-service
            servicePort: 80
  - host: app.my-domain.com
    http:
      paths:
        - backend:
            serviceName: web-frontend-service
            servicePort: 80
</code></pre>

<p>Here is a <a href="https://octoperf.com/blog/2019/09/05/kraken-kubernetes-ingress-nginx-frontend/" rel="noreferrer">guide</a> on how to serve angular 8 application on Minikube using Nginx ingress. </p>
