0

My Ingress Controller is not forwarding the request to the service, how can i fix it? I can see that my Ingress is missing addresses, but i do not know why.

I have a Kubernetes Cluster running on a 1 master, 2 worker setup on linux servers. I have a HAProxy forwarding my requests to Nginx Controllers. My complete setup is behind a corporate proxy. The DNS entry is enabled in this corporate proxy. Requests will get to the nginx controller, but wont be forwarded to the service. I installed the ingress controller as descibed by many tutorials with the files in https://github.com/nginxinc/kubernetes-ingress.

I'm new to stack overflow, so if i should give more specific information just let me know. I hope someone can help me with my issue, thank you in advance :D

My Ingress with missing Address:

Name:             app-ingress
Namespace:        default
Address:
Default backend:  default-http-backend:80 (<none>)
Rules:
  Host                       Path  Backends
  ----                       ----  --------
  test.kubetest.lff.bybn.de
                             /abc   app-service:80 (10.244.2.4:3000)
Annotations:                 kubernetes.io/ingress.class: nginx
Events:                      <none>

Yaml Files of Deployment, Service and Ingress, IngressClass, ConfigMap

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    run: app
  name: app-blue
spec:
  replicas: 1
  selector:
    matchLabels:
      run: app
      version: 0.0.1
  template:
    metadata:
      labels:
        run: app
        version: 0.0.1
    spec:
      containers:
      - name: app
        image: errm/versions:0.0.1
        ports:
        - containerPort: 3000
----



apiVersion: v1
kind: Service
metadata:
  name: app-service
spec:
  selector:
    run: app
    version: 0.0.1
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: 3000
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: app-ingress
  namespace: default
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  rules:
  - host: test.kubetest.lff.bybn.de
    http:
      paths:
      - path: /abc
        backend:
          serviceName: app-service
          servicePort: 80
---

apiVersion: networking.k8s.io/v1beta1
kind: IngressClass
metadata:
  name: nginx
  # annotations:
  #   ingressclass.kubernetes.io/is-default-class: "true"
spec:
  controller: nginx.org/ingress-controller
---

kind: ConfigMap
apiVersion: v1
metadata:
  name: nginx-config
  namespace: nginx-ingress
data:

Yaml File of Nginx Controller Deamonset

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: nginx-ingress
  namespace: nginx-ingress
spec:
  selector:
    matchLabels:
      app: nginx-ingress
  template:
    metadata:
      labels:
        app: nginx-ingress
     #annotations:
       #prometheus.io/scrape: "true"
       #prometheus.io/port: "9113"
    spec:
      serviceAccountName: nginx-ingress
      containers:
      - image: nginx/nginx-ingress:edge
        imagePullPolicy: Always
        name: nginx-ingress
        ports:
        - name: http
          containerPort: 80
          hostPort: 80
        - name: https
          containerPort: 443
          hostPort: 443
        - name: readiness-port
          containerPort: 8081
       #- name: prometheus
         #containerPort: 9113
        readinessProbe:
         httpGet:
           path: /nginx-ready
           port: readiness-port
         periodSeconds: 1
        securityContext:
          allowPrivilegeEscalation: true
          runAsUser: 101 #nginx
          capabilities:
            drop:
            - ALL
            add:
            - NET_BIND_SERVICE
        env:
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        args:
          - -nginx-configmaps=$(POD_NAMESPACE)/nginx-config
          - -default-server-tls-secret=$(POD_NAMESPACE)/default-server-secret
         #- -v=3 # Enables extensive logging. Useful for troubleshooting.
         #- -report-ingress-status
         #- -external-service=nginx-ingress
         #- -enable-prometheus-metrics
         #- -global-configuration=$(POD_NAMESPACE)/nginx-configuration

Curl from outside of the Cluster and Logs from Controller Pod

curl test.kubetest.lff.bybn.de/abc
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    93    0    93    0     0      1      0 --:--:--  0:00:50 --:--:--    26<html><body><h1>504 Gateway Time-out</h1>
The server didn't respond in time.
</body></html>



E0131 19:44:11.949261       1 reflector.go:138] /home/runner/work/kubernetes-ingress/kubernetes-ingress/internal/k8s/controller.go:574: Failed to watch *v1.Policy: failed to list *v1.Policy: the server could not find the requested resource (get policies.k8s.nginx.org)
E0131 19:45:06.894791       1 reflector.go:138] /home/runner/work/kubernetes-ingress/kubernetes-ingress/internal/k8s/controller.go:574: Failed to watch *v1.Policy: failed to list *v1.Policy: the server could not find the requested resource (get policies.k8s.nginx.org)
E0131 19:45:48.532075       1 reflector.go:138] /home/runner/work/kubernetes-ingress/kubernetes-ingress/internal/k8s/controller.go:574: Failed to watch *v1.Policy: failed to list *v1.Policy: the server could not find the requested resource (get policies.k8s.nginx.org)
10.48.25.57 - - [31/Jan/2021:19:46:35 +0000] "GET /abc HTTP/1.1" 499 0 "-" "curl/7.73.0" "-"
E0131 19:46:37.902444       1 reflector.go:138] /home/runner/work/kubernetes-ingress/kubernetes-ingress/internal/k8s/controller.go:574: Failed to watch *v1.Policy: failed to list *v1.Policy: the server could not find the requested resource (get policies.k8s.nginx.org)
E0131 19:47:15.346193       1 reflector.go:138] /home/runner/work/kubernetes-ingress/kubernetes-ingress/internal/k8s/controller.go:574: Failed to watch *v1.Policy: failed to list *v1.Policy: the server could not find the requested resource (get policies.k8s.nginx.org)
E0131 19:47:48.536636       1 reflector.go:138] /home/runner/work/kubernetes-ingress/kubernetes-ingress/internal/k8s/controller.go:574: Failed to watch *v1.Policy: failed to list *v1.Policy: the server could not find the requested resource (get policies.k8s.nginx.org)
E0131 19:48:21.890770       1 reflector.go:138] /home/runner/work/kubernetes-ingress/kubernetes-ingress/internal/k8s/controller.go:574: Failed to watch *v1.Policy: failed to list *v1.Policy: the server could not find the requested resource (get policies.k8s.nginx.org)

All endpoints

kubectl get endpoints --all-namespaces
NAMESPACE              NAME                                                 ENDPOINTS                                                              AGE
default                app-service                                          10.244.2.4:3000                                                        3d3h
default                kubernetes                                           10.48.25.144:6443                                                      45d
elastic                elastic-webhook-server                               10.244.1.92:9443                                                       17d
kube-system            default-http-backend                                 <none>                                                                 9d
kube-system            kube-dns                                             10.244.0.4:53,10.244.0.5:53,10.244.0.4:53 + 3 more...                  45d
kube-system            prometheus-kube-prometheus-coredns                   10.244.0.4:9153,10.244.0.5:9153                                        21d
kube-system            prometheus-kube-prometheus-kube-controller-manager   10.48.25.144:10252                                                     21d
kube-system            prometheus-kube-prometheus-kube-etcd                 10.48.25.144:2379                                                      21d
kube-system            prometheus-kube-prometheus-kube-proxy                10.48.25.144:10249,10.48.25.145:10249,10.48.25.90:10249                21d
kube-system            prometheus-kube-prometheus-kube-scheduler            10.48.25.144:10251                                                     21d
kube-system            prometheus-kube-prometheus-kubelet                   10.48.25.144:10250,10.48.25.145:10250,10.48.25.90:10250 + 6 more...    24d
kube-system            prometheus-prometheus-oper-kubelet                   10.48.25.144:10250,10.48.25.145:10250,10.48.25.144:10255 + 3 more...   24d
kubernetes-dashboard   dashboard-metrics-scraper                            10.244.0.6:8000                                                        25d
kubernetes-dashboard   kubernetes-dashboard                                 10.244.0.7:8443                                                        25d
monitoring             alertmanager-operated                                10.244.1.83:9094,10.244.1.83:9094,10.244.1.83:9093                     21d
monitoring             graphana1-grafana                                    10.244.1.85:3000,10.244.1.89:3000                                      44d
monitoring             prometheus-grafana                                   10.244.1.95:3000                                                       21d
monitoring             prometheus-kube-prometheus-alertmanager              10.244.1.83:9093                                                       21d
monitoring             prometheus-kube-prometheus-operator                  10.244.1.93:8443                                                       21d
monitoring             prometheus-kube-prometheus-prometheus                10.244.1.94:9090                                                       21d
monitoring             prometheus-kube-state-metrics                        10.244.1.88:8080                                                       21d
monitoring             prometheus-operated                                  10.244.1.94:9090                                                       21d
monitoring             prometheus-prometheus-node-exporter                  10.48.25.144:9100,10.48.25.145:9100,10.48.25.90:9100                   21d
jergan95
  • 3
  • 4
  • What is the host OS and CNI? And what do you mean by "I can see that my Ingress is missing addresses"? where do you see this? what addresses? Also please provde the output of `kubectl get endpoints` – Matt Feb 01 '21 at 09:10
  • Thank you for your advice, i will add the missing information. If i run kubectl describe Ingress there should be ip-Adress of all Nodes at the "Adress" value. Atleast every working setup i looked at, had the node adresses there. I am using Ubuntu 20.04.1 and Flannel as CNI. – jergan95 Feb 01 '21 at 12:29
  • Can you point me to the exact yaml file you used to deploy nginx ingress controller? Also, I don't see any endpoint for nginx ingress controller - are you sure that you created a service for nginx ingress? Additionally, based on logs, you are using [nginxinc ingress controller](https://github.com/nginxinc/kubernetes-ingress) but you provided the link to [k8s ingress cnrtoleer](https://github.com/kubernetes/ingress-nginx) (no, they are not the same thing), so what are you actually using. – Matt Feb 01 '21 at 13:11
  • I added the yaml file from my nginx controller deamonset. I didnt create any service, but in the tutorials i watched it wasnt necessary. Do i need one? Oh I am sorry, i linked the wrong repo. Im using the nginxinc ingress controller – jergan95 Feb 04 '21 at 09:17
  • Please read the manual https://docs.nginx.com/nginx-ingress-controller/installation/installation-with-manifests/#prerequisites It's all in the documentation – Matt Feb 04 '21 at 09:23
  • I got it working now. The main thing was the missing ingress.class annotation. But i didnt got it figured out because my test application was throwing 404. As soon as i tried out another service it worked... – jergan95 Feb 04 '21 at 09:56
  • But thank you for your help! – jergan95 Feb 04 '21 at 09:57
  • Would you mind providing the answer to this question in the answers section for better visibility? – Matt Feb 15 '21 at 08:31

0 Answers0