You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Kubectl Ingress路由posts.com/posts返回404 Not Found问题排查求助

Kubectl Ingress路由posts.com/posts返回404 Not Found问题排查求助

各位大佬好,我最近在配置Kubernetes Ingress时碰到了个棘手的问题,访问http://posts.com/posts一直返回404 Not Found,已经一步步检查了相关配置,但还是没找出问题所在,麻烦大家帮忙看看哪里出错了🙏

我的Ingress配置文件(ingress-srv.yaml)

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-srv
  annotations:
    nginx.ingress.kubernetes.io/ingress.class: nginx
spec:
  rules:
  - host: posts.com
    http:
      paths:
      - path: /posts
        pathType: Prefix
        backend:
          service:
            name: posts-clusterip-srv
            port:
              number: 4000

本地Hosts文件配置

# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1   localhost
255.255.255.255 broadcasthost
::1             localhost
127.0.0.1 posts.com
# 补充:已确认TCP 80端口处于开放状态

遇到的具体问题

当我访问http://posts.com/posts时,浏览器控制台返回错误:GET http://posts.com/posts 404 (Not Found)。我已经排查过以下内容,但问题依然存在:

  • Ingress资源已成功部署,执行kubectl get ingress能正常看到该资源
  • 后端的posts-clusterip-srv ClusterIP Service状态正常,通过ClusterIP可以直接访问到后端Pod
  • 后端Pod处于Running状态,且Pod内部的服务本身能正常响应请求

有没有大佬能帮我分析下可能的问题点?

备注:内容来源于stack exchange,提问作者LikapaTR

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.20 13:04:29