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

GCP上NextJS应用Kubernetes就绪探针失败求助

GCP环境中NextJS应用Kubernetes就绪检查持续失败

问题现象

  • 未配置timeoutSeconds: 10时,报错:Readiness probe failed: Get "http://10.60.2.69:3000/api/healthcheck": context deadline exceeded (Client.Timeout exceeded while awaiting headers),推测已成功连接Pod。
  • 添加该超时配置后,等待一段时间出现报错:Timeout waiting for pod to become healthy in at least one of the NEG(s): [k8s1-8e09c...]. Marking condition "cloud.google.com/load-balancer-neg-ready" to True.

相关配置文件

client-deployment.yaml

kind: Deployment
metadata:
  name: client-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: client
  template:
    metadata:
      labels:
        app: client
    spec:
      containers:
        - name: client
          image: nodejsclient
          readinessProbe:
            httpGet:
              path: /api/healthcheck
              port: 3000
            initialDelaySeconds: 10
            periodSeconds: 10
            timeoutSeconds: 10
            failureThreshold: 3
---
apiVersion: v1
kind: Service
metadata:
  name: client-service
spec:
  selector:
    app: client
  ports:
    - name: client
      protocol: TCP
      port: 3000
      targetPort: 3000

健康检查API文件(pages/api/healthchek.ts)

export default function HealthPage (req: NextApiRequest, res: NextApiResponse){
   res.status(200).json({status: 'OK'})
}

更新信息

  • UPDATE:通过curl直接访问Pod的/api/healthcheck路径可获得200响应。
  • UPDATE2:尝试多种就绪探针配置(删除探针、设为NULL、使用根路径、调整超时参数、改用命令式探针等),并重新创建Ingress,问题依旧;同时发现报错Unable to determine the pod's node name,暂不确定是否与当前问题相关。

内容的提问来源于stack exchange,提问作者gil

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.16 14:52:18