8
votes

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@kubemaster ingress-controller-domain-name-or-path-based-routing]$ kubectl describe ing hotel-ingress --namespace 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:


apiVersion: v1
kind: Namespace
metadata:
name: hotel

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
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
apiVersion: v1
kind: Service
metadata:
name: hotel-svc
namespace: hotel
spec:
ports:

port: 80
targetPort: 80
selector:
app: hotel
6
Can you instead of describe Ingress/deployment etc. paste separately those file - in yaml format ? - Malgorzata
Hii, Issue has been fixed, i created one default-http-backend service in kube-system namespace and above error gone. - Ankit Gulati
In such case can you edit question and then paste solution as an answer according to StackOverflow rules? - Malgorzata

6 Answers

5
votes

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:

kubectl apply -f https://raw.githubusercontent.com/roelal/minikube/5093d8b21c0931a6c63fa448538761b4bf100ee0/deploy/addons/ingress/ingress-rc.yaml
kubectl apply -f https://raw.githubusercontent.com/roelal/minikube/5093d8b21c0931a6c63fa448538761b4bf100ee0/deploy/addons/ingress/ingress-svc.yaml

Sourced from https://github.com/roelal/minikube/tree/5093d8b21c0931a6c63fa448538761b4bf100ee0/deploy/addons/ingress

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.

3
votes

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
0
votes
0
votes

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.

0
votes

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
-7
votes

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

See more: ngress-nginx-troubleshooting.