Ankit Gulati
Ankit Gulati

Reputation: 507

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

Upvotes: 47

Views: 89668

Answers (7)

Ray
Ray

Reputation: 1334

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.

Upvotes: 7

Nicholas Petersen
Nicholas Petersen

Reputation: 9558

The answer in my case was found here, which is that the ingress rule needs to be created in the same namespace as the service rule(s) its referencing. Or else, as discussed in the same thread, one must find a way to include the namespace as part of the reference to that service.

Instead of creating the ingress your-ingress-name in ingress-nginx namespace you should create it in the namespace where you have the service...

Possible solution if you're getting this result:

kubectl describe ingress your-ingress-name

...
Default backend:  default-http-backend:80 (<error: endpoints "default-http-backend" not found>)

Upvotes: 1

nakhodkin
nakhodkin

Reputation: 1465

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

Upvotes: 26

mirekphd
mirekphd

Reputation: 6791

I think missing default backend can be ignored. At least it is not required for Openshift-style routes with load-balancing work under k8s, as described in this answer.

Upvotes: 1

Abhishek Deshmukh
Abhishek Deshmukh

Reputation: 189

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

Upvotes: 6

bzani
bzani

Reputation: 527

I tried following this doc steps and it worked fine: https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/

Upvotes: 0

Malgorzata
Malgorzata

Reputation: 7023

Create default-http-backend service in kube-system namespace and error will be gone.

See more: ngress-nginx-troubleshooting.

Upvotes: -14

Related Questions