谁动了我的数据库! 2022-04-06 14:48 采纳率: 50%
浏览 91
已结题

k8s ingres访问失败

学习环境
所使用的pod信息


kubectl get pod -n test -o wide
NAME                                 READY   STATUS    RESTARTS      AGE   IP               NODE        NOMINATED NODE   READINESS GATES
nginx-deployment-5c767764f5-5ffpm    1/1     Running   1 (17h ago)   17h   10.244.169.167   k8s-node2   <none>           <none>
nginx-deployment-5c767764f5-6gs8s    1/1     Running   1 (17h ago)   17h   10.244.169.166   k8s-node2   <none>           <none>
nginx-deployment-5c767764f5-vcnmv    1/1     Running   1 (17h ago)   17h   10.244.36.98     k8s-node1   <none>           <none>
tomcat-deployment-7db86c59b7-kmbls   1/1     Running   1 (17h ago)   17h   10.244.36.97     k8s-node1   <none>           <none>
tomcat-deployment-7db86c59b7-krh95   1/1     Running   1 (17h ago)   17h   10.244.169.165   k8s-node2   <none>           <none>
tomcat-deployment-7db86c59b7-zbp5g   1/1     Running   1 (17h ago)   17h   10.244.36.96     k8s-node1   <none>           <none>
#ingress pod 信息
kubectl get pod -n ingress-nginx
NAME                                        READY   STATUS      RESTARTS   AGE
ingress-nginx-admission-create--1-cxqkl     0/1     Completed   0          7m9s
ingress-nginx-admission-patch--1-t6whc      0/1     Completed   0          7m9s
ingress-nginx-controller-6b64bc6f47-qqgf2   1/1     Running     0          7m9s
#ingress service创建信息
kubectl get svc -n ingress-nginx
NAME                                 TYPE        CLUSTER-IP    EXTERNAL-IP   PORT(S)                      AGE
ingress-nginx-controller             NodePort    10.1.71.159   <none>        80:32704/TCP,443:32764/TCP   5m28s
ingress-nginx-controller-admission   ClusterIP   10.1.56.158   <none>        443/TCP                      5m28s

规则创建信息

kubectl get ing -n test
NAME           CLASS             HOSTS                            ADDRESS   PORTS   AGE
ingress-http   ingress-example   nginx.test.com,tomcat.test.com             80      17h
#详细信息 ingress
kubectl describe ing -n test
Name:             ingress-http
Namespace:        test
Address:          
Default backend:  default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
Rules:
  Host             Path  Backends
  ----             ----  --------
  nginx.test.com   
                   /   nginx-service:80 (10.244.169.166:80,10.244.169.167:80,10.244.36.98:80)
  tomcat.test.com  
                   /   tomcat-service:8080 (10.244.169.165:8080,10.244.36.96:8080,10.244.36.97:8080)
Annotations:       <none>
Events:            <none>
hosts 文件信息

192.168.100.60 nginx.test.com
192.168.100.60 tomcat.test.com 

访问失败


curl nginx.test.com:32704
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>

我想要达到的结果 ,是以域名的方式访问到如下结果。
这边是直接访问的调度pod

curl 10.244.169.167
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
  • 写回答

2条回答

      报告相同问题?

      相关推荐 更多相似问题

      问题事件

      • 系统已结题 4月14日
      • 赞助了问题酬金10元 4月6日
      • 创建了问题 4月6日

      悬赏问题

      • ¥15 SQL查询一个表格的数据
      • ¥20 PCL库处理梯子点云获取其几何参数
      • ¥30 医疗资料ROI mask转YOLO的bounding box
      • ¥15 docx4j word转pdf
      • ¥15 MATLAB-GUI数据图表
      • ¥15 Qt Vs2017使用Charts异常
      • ¥15 将位图选入内存DC失败,但没有出错信息
      • ¥20 如何从 .html url 启动/激活 .py 文件(sql debug)
      • ¥15 c#调用soap出错,soapui中可以
      • ¥100 CBIS-DDSM kaggle 资料处理