Question

Kubernetes deployment api service with nginx at certain domain always get 404 or 502

Hi,

I started to learn some kubernetes for our project. Firstly created kubernetes cluster and added ingress-nginx from marketplace. After that follow this tutorial to deploy a api service.

After tha deploy my project and ingress my xxx.aaa.com domain always response 404.

Where am i going wrong?

My Deployment yaml:

apiVersion: v1
kind: Service
metadata:
  name: myservice
spec:
  ports:
  - port: 80
    targetPort: 8080
  selector:
    app: myservice
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: myservice
spec:
  selector:
    matchLabels:
      app: myservice
  replicas: 2
  template:
    metadata:
      labels:
        app: myservice
    spec:
      containers:
      - name: myservice
        image: hub/myservice:latest
        ports:
        - containerPort: 8080
  clusters:
  - cluster:
      certificate-authority-data: secret
      server: secret
    name: secret
  contexts:
  - context:
      cluster: secret
      user: secret
  current-context: secret
  kind: Config
  preferences: {}
  users:
  - name: secret
    user:
      token: scret

My Ingress Yaml:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: myservice
  annotations:
    kubernetes.io/ingress.class: "public"
spec:
  rules:
  - host: myservice.mydomain.com
    http:
        paths:
        - pathType: Prefix
          path: "/"
          backend:
            service:
              name: myservice
              port:
                number: 80

Following tutorial: https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nginx-ingress-with-cert-manager-on-digitalocean-kubernetes

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!