skip to Main Content

I’m using this nginx ingress controller on Hetzner server. After installation of ingress controller, I’m able to access the worker node by its IP, but not able to access the app running on pod inside the cluster. am I missing something?
Are Ingress and Traefik are different, a bit confused in the terminologies.

service file –

apiVersion: v1
kind: Service
metadata:
  name: service-name-xxx
spec:
  selector:
    app: app-name
  ports:
    - protocol: 'TCP'
      port: 80
      targetPort: 4200
  type: LoadBalancer

deployment file –

apiVersion: apps/v1
kind: Deployment
metadata:
  name: deployment-name
  labels:
    app: app-name
spec:
  replicas: 1
  selector:
    matchLabels:
      app: app-name
  template:
    metadata:
      labels:
        app: app-name
    spec:
      imagePullSecrets:
      - name: my-registry-key
      containers:
      - name: container-name
        image: my-private-docker-img
        imagePullPolicy: Always
        ports:
        - containerPort: 4200

ingress file –

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-name
spec:
  rules:
  - host:
    http:
      paths:
      - pathType: Prefix
        path: "/app"
        backend:
          service:
            name: service-name-xxx
            port:
              number: 4200

2

Answers


  1. You have set port to 80 and targetPort to 4200 in your service. Should mention port 80 in your ingress yaml.

    backend:
        service:
          name: service-name-xxx
          port: 80
          targetPort: 4200
    
    Login or Signup to reply.

  2. I think you have to add the kubernetes.io/ingress.class: "nginx" to your Ingress

    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: ingress-name
        spec:
          name: hsts-ingress-backend1-minion
          annotations:
            kubernetes.io/ingress.class: "nginx"
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search