Ingress to nginx backend pod not working

I want to make a simple nginx backend where i can connect externally. The basic nginx welcome page works when i do a port-foward to localhost but does not work when i make a call from external. When i make a call from outside, i get 404 Not Found nginx/1.19.2

here are all 3 files:

deploy yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-nginx
spec:
  selector:
    matchLabels:
      run: my-nginx
  replicas: 1
  template:
    metadata:
      labels:
        run: my-nginx
    spec:
      containers:
      - name: my-nginx
        image: nginx
        ports:
        - containerPort: 80

service:
apiVersion: v1
kind: Service
metadata:
  name: my-nginx
  labels:
    run: my-nginx
spec:
  ports:
  - port: 80
    protocol: TCP
  selector:
    run: my-nginx

~

ingress:


kind: Ingress
apiVersion: networking.k8s.io/v1beta1
metadata:
  name: myingress
  annotations:
    traefik.ingress.kubernetes.io/router.entrypoints: websecure
    traefik.ingress.kubernetes.io/router.tls: "true"
spec:
  rules:
    - http:
        paths:
          - path: /bar
            backend:
              serviceName: my-nginx
              servicePort: 80
  tls:
  - secretName: traefik-default-cert

Do you call the url with https?

yes, it's 443. i got this working. Thanks.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.