如何解决default-http-backend:80<错误:未找到端点“default-http-backend”>
我的两个域 one.example.com
和 two.example.com
的连接超时。
我已经使用 kops 在 AWS 上设置了集群。
Ingress 位于默认命名空间内,被代理的服务也位于默认命名空间内。
apiVersion: networking.k8s.io/v1
kind: Ingress
Metadata:
name: ingress-service-api
annotations:
kubernetes.io/ingress.class: Nginx
Nginx.ingress.kubernetes.io/use-regex: "true"
Nginx.ingress.kubernetes.io/rewrite-target: /$1
certmanager.k8s.io/cluster-issuer: "letsencrypt-example-prod"
Nginx.ingress.kubernetes.io/ssl-redirect: "true"
spec:
tls:
- hosts:
- one.example.in
secretName: api-example-in
rules:
- host: one.example.in
http:
paths:
- path: /customer/?(.*)
pathType: Prefix
backend:
service:
name: customer-srv
port:
number: 3000
---
apiVersion: networking.k8s.io/v1
kind: Ingress
Metadata:
name: ingress-service-monitor
annotations:
kubernetes.io/ingress.class: Nginx
Nginx.ingress.kubernetes.io/use-regex: "true"
certmanager.k8s.io/cluster-issuer: "letsencrypt-example-prod"
Nginx.ingress.kubernetes.io/ssl-redirect: "true"
spec:
tls:
- hosts:
- two.example.in
secretName: api-example-in
rules:
- host: two.example.in
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: kube-prometheus-grafana
port:
number: 80
$ kubectl describe ingress ingress-service-monitor
Warning: extensions/v1beta1 Ingress is deprecated in v1.14+,unavailable in v1.22+; use networking.k8s.io/v1 Ingress
Name: ingress-service-monitor
Namespace: default
Address: dns.elb.ap-south-1.amazonaws.com
Default backend: default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
TLS:
api-example-in terminates two.example.in
Rules:
Host Path Backends
---- ---- --------
monitor.example.in
/ kube-prometheus-grafana:80 (100.96.4.3:3000)
Annotations: certmanager.k8s.io/cluster-issuer: letsencrypt-example-prod
kubernetes.io/ingress.class: Nginx
Nginx.ingress.kubernetes.io/ssl-redirect: true
Nginx.ingress.kubernetes.io/use-regex: true
为了安装控制器,我遵循了 this doc。 我只运行了这个命令
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-Nginx/controller-v0.44.0/deploy/static/provider/aws/deploy.yaml
我在这里列出了有关入口部署的其他信息
[ec2-user@ip ~]$ kubectl get all -n ingress-Nginx
NAME READY STATUS RESTARTS AGE
pod/ingress-Nginx-admission-create-5wpwn 0/1 Completed 0 3h39m
pod/ingress-Nginx-admission-patch-6z2wx 0/1 Completed 2 3h39m
pod/ingress-Nginx-controller-7fc74cf778-64vk2 1/1 Running 0 91m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/ingress-Nginx-controller LoadBalancer 100.68.82.233 5e06c70e0a8b9d4b.elb.ap-south-1.amazonaws.com 80:31336/TCP,443:30936/TCP 3h39m
service/ingress-Nginx-controller-admission ClusterIP 100.64.118.59 <none> 443/TCP 3h39m
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/ingress-Nginx-controller 1/1 1 1 91m
NAME DESIRED CURRENT READY AGE
replicaset.apps/ingress-Nginx-controller-7fc74cf778 1 1 1 91m
NAME COMPLETIONS DURATION AGE
job.batch/ingress-Nginx-admission-create 1/1 10s 3h39m
job.batch/ingress-Nginx-admission-patch 1/1 21s 3h39m
[ec2-user@ip ~]$
解决方法
通过检查您正在运行的 API 版本或您的 Ingress 支持的 API 版本来尝试
你可以运行:kubectl api-resources -o wide
检查您的网络支持的 API 版本。如果它支持 extensions/v1beta1
,您可以使用它,示例如下。
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
certmanager.k8s.io/cluster-issuer: secret
cert-manager.io/cluster-issuer: secret
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/proxy-body-size: 50m
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-connect-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/secure-backends: "true"
nginx.ingress.kubernetes.io/ssl-redirect: "true"
nginx.ingress.kubernetes.io/websocket-services: core
nginx.org/websocket-services: core
name: service-ingress
namespace: default
spec:
rules:
- host: app.example.io
http:
paths:
- backend:
serviceName: core
servicePort: 80
tls:
- hosts:
- app.example.io
secretName: secret
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。