Kubernetes Ingress Nginx Controller 404 Not Found

12/8/2020

I am trying to use Kubernetes Ingress Nginx Controller and when I run skaffold run and go to host through my browser, the browser page displays 404 Not Found nginx. I tried running my docker image in a docker container and that works fine so I don't think there is anything run with my Dockerfile. (I am just trying to run a blank React App)

Here is my code for /infra/k8s/ingress-srv.yaml:

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: ingress-srv
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/use-regex: 'true'
spec:
  rules:
    - host: posts.com
      http:
        paths:
          - path: /?(.*)
            backend:
              serviceName: client-srv
              servicePort: 3000

And here is my code for /infra/k8s/client-depl.yaml (I'm putting client service in the same file):

apiVersion: apps/v1
kind: Deployment
metadata:
  name: client-depl
spec:
  replicas: 1
  selector:
    matchLabels:
      app: client
  template:
    metadata:
      labels:
        app: client
    spec:
      containers:
        - name: client
          image: aidenhsy/client
---
apiVersion: v1
kind: Service
metadata:
  name: client-srv
spec:
  selector:
    app: client
  ports:
    - name: client
      protocol: TCP
      port: 3000
      targetPort: 3000

And finally here is my skaffold.yaml in the root folder:

apiVersion: skaffold/v2alpha3
kind: Config
deploy:
  kubectl:
    manifests:
      - ./infra/k8s/*
build:
  local:
    push: false
  artifacts:
    - image: aidenhsy/client
      context: client
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: 'src/**/*.js'
            dest: .

Here is a screenshot of an image of the webpage when I try to load it screenshot

Any help would be greatly appreciated!

AY.

-- Aidenhsy
docker
kubernetes
kubernetes-ingress

0 Answers