Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

endpoints “default-http-backend” not found in Ingress resource

When I am trying to create an ingress resource for my Kubernetes cluster(ingress controller is already created), Ingress resource/rules are creating and I am able to see in the kubectl get ing. But when I do kubectl describe, I am seeing a error:

Default backend: default-http-backend:80 (<error: endpoints “default-http-backend” not found>)

Is this expected?? I am not even able to connect to my application using the DNS name (hotel.example.com) which I defined in Ingress resource. Is it due to this http-backend error? If not, any suggestions to make the application connect!!

[dockuser@hostname]$ kubectl describe ing hotel-ingress -n hotel
Name:             hotel-ingress
Namespace:        hotel
Address:
Default backend:  default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
Rules:
  Host         Path  Backends
  ----         ----  --------

  hotel.example.com
               /     hotel-svc:80 (10.36.0.2:80,10.44.0.2:80)
Annotations: 
Events:

deployment files: namespaces.yaml

apiVersion: v1
kind: Namespace
metadata:
  name: hotel

ingress.yaml

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: hotel-ingress
  namespace: hotel
spec:
  rules:
  - host: hotel.example.com
    http:
      paths:
      - path: /
        backend:
          serviceName: hotel-svc
          servicePort: 80

deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: hotel
  namespace: hotel
spec:
  replicas: 2
  selector:
    matchLabels:
      app: hotel
  template:
    metadata:
      labels:
        app: hotel
    spec:
      containers:
      - name: hotel
        image: nginxdemos/hello:plain-text
        ports:
          - containerPort: 80

service.yaml

apiVersion: v1
kind: Service
metadata:
  name: hotel-svc
  namespace: hotel
spec:
  selector:
    app: hotel
  ports:
    - port: 80
      targetPort: 80
like image 727
Ankit Gulati Avatar asked Aug 24 '20 09:08

Ankit Gulati


Video Answer


3 Answers

You may want add defaultBackend as a part of your Ingress definition like so

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: default-backend-ingress-example
spec:
  defaultBackend:
    service:
      name: hotel-svc
      port:
        number: 80

Environment

minikube version: v1.21.0
kubectl version: v1.20.7
like image 193
nakhodkin Avatar answered Sep 22 '22 22:09

nakhodkin


I realize this was answered (adding for posterity,) however in my case I had already ran

minikube addons enable ingress

but system was still missing default-http-backend.

I suspect that at the time there had been a conflicting use of a port or some such and the default-http-backend silently failed to be created.

After many attempts to correct the issue I finally discovered that executing the following commands fixed the issue for me:

[update 2021-12-15]

original resources no longer available, sorry

If I had to do this again today I would probably try to apply a deployment directly from the ingress-nginx project:

kubectl apply -f https://github.com/kubernetes/ingress-nginx/tree/main/deploy/static/provider/baremetal/deploy.yaml

(not tested)

PS: Note that there already were configmaps present for nginx-load-balancer-conf so I didn't add those.

PPS: Secondly, this was just for education on a local laptop so take its trustworthiness with a grain of salt.

like image 28
Ray Avatar answered Sep 22 '22 22:09

Ray


If you are using Minikube, it may be because you haven't enabled ingress.

Please try the command below:

minikube addons enable ingress

or

minikube addons enable ingress --alsologtostderr
like image 36
Abhishek Deshmukh Avatar answered Sep 22 '22 22:09

Abhishek Deshmukh