Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

kubernetes - default-http-backend is stopping me to hit the ingress rule created

Am installing nginx-controller to expose the service, after installing the ingress resource am not able to hit the desired port. i get failed saying the below,

[root@k8-m smartrem]# kubectl describe ingress ingress-svc
Name:             ingress-svc
Namespace:        default
Address:
Default backend:  default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
Rules:
  Host          Path  Backends
  ----          ----  --------
  auditmee.com
                /swagger-ui.html   springboot-service:8080 (192.168.157.76:8080,192.168.157.77:8080,192.168.250.8:8080)
Annotations:    <none>
Events:         <none>

I see the errors are related to default-http-backend, how to create the default-http-backend service.

Any help would be highly appreciated


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

There are several parts in this question, I do think need to be addressed:


  1. There are multiple NGINX Ingress Controllers available to use within Kubernetes environment. Specifying which exact one is used will definitely help in troubleshooting process as there could be slight differences in their inner workings that could affect your workload.

You can read more about this topic (NGINX based Ingress controllers) by following this thread:

A side note!

I saw you're using this specific Ingress controller as per previous question asked on StackOverflow:


  1. What is a default-backend?

default-backend in short is a "place" (Deployment with a Pod and a Service) where all the traffic that doesn't match Ingress resource is sent (for example unknown path).

Your Ingress resource is displaying following message:

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

As it can't find an Endpoint named default-http-backend (with associated Service of the same name). To fix that you'll need to provision such resources.

Example of such default-backend implementation:


  1. Ingress resources and it's path

As for your Ingress resource. It's crucial to include YAML manifests for resources you are deploying. It's easier for other community member to see the whole pictures and the potential issues you are facing.

By the part of the: $ kubectl describe ingress ingress-svc it can be seen:

Rules:
  Host          Path  Backends
  ----          ----  --------
  auditmee.com
                /swagger-ui.html   springboot-service:8080 (192.168.157.76:8080,...) 

There is a host: HOST.com that have one really specific path (file to be exact). Setup like this will allow your client to have access only to swagger-ui.html. If you had some other files, there wouldn't be available:

  • curl http://HOST/swagger-ui.html <-- 200
  • curl http://HOST/super-awesome-icon.png <-- 404

A side note!

Also please check on which protocol HTTP/HTTPS are you serving your resources.

As your workload is unknown to us, you could try to set your path to path: /. This rule would allow all request for resources for HOST to be passed to your springboot-service.


I encourage you to check available documentation for more resources:

I also found displaying logs of the Ingress controller to be highly effective in troubleshooting:

  • $ kubectl logs -n NAMESPACE INGRESS-POD-NAME

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...