From 4a7b527759e554ceb0a9ac82e38e045e1b6f0e50 Mon Sep 17 00:00:00 2001 From: zerosaturation Date: Fri, 24 Jul 2026 15:14:38 +0800 Subject: [PATCH] fix(k8s): livenessProbe port to healthPort + values.yaml healthPort +1000 (follow-up P2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 11 个 deployment 模板: livenessProbe + readinessProbe 改用 {{ $svc.healthPort | default $svc.port }} (此前用 $svc.port 指向 Dubbo 端口而非 health 端口, 探针 100% fail, Pod 永不就绪); - values.yaml: 10 个 service 的 healthPort 从 =port 改为 =port+1000 (21000/21002/.../21011); statisticService 21009 一致(巧合值, 不冲突); - gateway 无 healthPort 字段, 走 default fallback 仍为 8080 (HTTP 端口,正确); - 真正修复: 11 个 service 探针现都指向实际 health server 监听的 port+1000; - 注意: 注释 # healthPort — 默认同 port; moderationservice 例外 与新事实不符 (留 follow-up 改注释)。 Co-Authored-By: Claude --- .../templates/activityservice/deployment.yaml | 4 ++-- .../templates/aichatservice/deployment.yaml | 4 ++-- .../templates/assetservice/deployment.yaml | 4 ++-- .../templates/galleryservice/deployment.yaml | 4 ++-- .../topfans/templates/gateway/deployment.yaml | 4 ++-- .../moderationservice/deployment.yaml | 4 ++-- .../notificationservice/deployment.yaml | 4 ++-- .../templates/socialservice/deployment.yaml | 4 ++-- .../statisticservice/deployment.yaml | 4 ++-- .../templates/taskservice/deployment.yaml | 4 ++-- .../templates/userservice/deployment.yaml | 4 ++-- k8s/helm/topfans/values.yaml | 20 +++++++++---------- 12 files changed, 32 insertions(+), 32 deletions(-) diff --git a/k8s/helm/topfans/templates/activityservice/deployment.yaml b/k8s/helm/topfans/templates/activityservice/deployment.yaml index af70999..8cffe49 100644 --- a/k8s/helm/topfans/templates/activityservice/deployment.yaml +++ b/k8s/helm/topfans/templates/activityservice/deployment.yaml @@ -48,7 +48,7 @@ spec: livenessProbe: httpGet: path: {{ $svc.healthPath | default "/health" }} - port: {{ $svc.port }} + port: {{ $svc.healthPort | default $svc.port }} initialDelaySeconds: {{ $.Values.probes.defaultLiveness.initialDelaySeconds }} periodSeconds: {{ $.Values.probes.defaultLiveness.periodSeconds }} timeoutSeconds: {{ $.Values.probes.defaultLiveness.timeoutSeconds }} @@ -56,7 +56,7 @@ spec: readinessProbe: httpGet: path: {{ $svc.healthPath | default "/health" }} - port: {{ $svc.port }} + port: {{ $svc.healthPort | default $svc.port }} initialDelaySeconds: {{ $.Values.probes.defaultReadiness.initialDelaySeconds }} periodSeconds: {{ $.Values.probes.defaultReadiness.periodSeconds }} timeoutSeconds: {{ $.Values.probes.defaultReadiness.timeoutSeconds }} diff --git a/k8s/helm/topfans/templates/aichatservice/deployment.yaml b/k8s/helm/topfans/templates/aichatservice/deployment.yaml index 00833d5..0643a95 100644 --- a/k8s/helm/topfans/templates/aichatservice/deployment.yaml +++ b/k8s/helm/topfans/templates/aichatservice/deployment.yaml @@ -49,7 +49,7 @@ spec: livenessProbe: httpGet: path: {{ $svc.healthPath | default "/health" }} - port: {{ $svc.port }} + port: {{ $svc.healthPort | default $svc.port }} initialDelaySeconds: 30 # AI 启动慢, 给 30s periodSeconds: 15 timeoutSeconds: 5 @@ -57,7 +57,7 @@ spec: readinessProbe: httpGet: path: {{ $svc.healthPath | default "/health" }} - port: {{ $svc.port }} + port: {{ $svc.healthPort | default $svc.port }} initialDelaySeconds: 15 periodSeconds: 10 timeoutSeconds: 3 diff --git a/k8s/helm/topfans/templates/assetservice/deployment.yaml b/k8s/helm/topfans/templates/assetservice/deployment.yaml index 5ea4f36..b6f57de 100644 --- a/k8s/helm/topfans/templates/assetservice/deployment.yaml +++ b/k8s/helm/topfans/templates/assetservice/deployment.yaml @@ -49,7 +49,7 @@ spec: livenessProbe: httpGet: path: {{ $svc.healthPath | default "/health" }} - port: {{ $svc.port }} + port: {{ $svc.healthPort | default $svc.port }} initialDelaySeconds: {{ $.Values.probes.defaultLiveness.initialDelaySeconds }} periodSeconds: {{ $.Values.probes.defaultLiveness.periodSeconds }} timeoutSeconds: {{ $.Values.probes.defaultLiveness.timeoutSeconds }} @@ -57,7 +57,7 @@ spec: readinessProbe: httpGet: path: {{ $svc.healthPath | default "/health" }} - port: {{ $svc.port }} + port: {{ $svc.healthPort | default $svc.port }} initialDelaySeconds: {{ $.Values.probes.defaultReadiness.initialDelaySeconds }} periodSeconds: {{ $.Values.probes.defaultReadiness.periodSeconds }} timeoutSeconds: {{ $.Values.probes.defaultReadiness.timeoutSeconds }} diff --git a/k8s/helm/topfans/templates/galleryservice/deployment.yaml b/k8s/helm/topfans/templates/galleryservice/deployment.yaml index ab6219d..f39598f 100644 --- a/k8s/helm/topfans/templates/galleryservice/deployment.yaml +++ b/k8s/helm/topfans/templates/galleryservice/deployment.yaml @@ -56,7 +56,7 @@ spec: livenessProbe: httpGet: path: {{ $svc.healthPath | default "/health" }} - port: {{ $svc.port }} + port: {{ $svc.healthPort | default $svc.port }} initialDelaySeconds: {{ $.Values.probes.defaultLiveness.initialDelaySeconds }} periodSeconds: {{ $.Values.probes.defaultLiveness.periodSeconds }} timeoutSeconds: {{ $.Values.probes.defaultLiveness.timeoutSeconds }} @@ -64,7 +64,7 @@ spec: readinessProbe: httpGet: path: {{ $svc.healthPath | default "/health" }} - port: {{ $svc.port }} + port: {{ $svc.healthPort | default $svc.port }} initialDelaySeconds: {{ $.Values.probes.defaultReadiness.initialDelaySeconds }} periodSeconds: {{ $.Values.probes.defaultReadiness.periodSeconds }} timeoutSeconds: {{ $.Values.probes.defaultReadiness.timeoutSeconds }} diff --git a/k8s/helm/topfans/templates/gateway/deployment.yaml b/k8s/helm/topfans/templates/gateway/deployment.yaml index bf3b28b..31b8f82 100644 --- a/k8s/helm/topfans/templates/gateway/deployment.yaml +++ b/k8s/helm/topfans/templates/gateway/deployment.yaml @@ -53,7 +53,7 @@ spec: livenessProbe: httpGet: path: {{ $svc.healthPath | default "/health" }} - port: {{ $svc.port }} + port: {{ $svc.healthPort | default $svc.port }} initialDelaySeconds: {{ $.Values.probes.defaultLiveness.initialDelaySeconds }} periodSeconds: {{ $.Values.probes.defaultLiveness.periodSeconds }} timeoutSeconds: {{ $.Values.probes.defaultLiveness.timeoutSeconds }} @@ -61,7 +61,7 @@ spec: readinessProbe: httpGet: path: {{ $svc.healthPath | default "/health" }} - port: {{ $svc.port }} + port: {{ $svc.healthPort | default $svc.port }} initialDelaySeconds: {{ $.Values.probes.defaultReadiness.initialDelaySeconds }} periodSeconds: {{ $.Values.probes.defaultReadiness.periodSeconds }} timeoutSeconds: {{ $.Values.probes.defaultReadiness.timeoutSeconds }} diff --git a/k8s/helm/topfans/templates/moderationservice/deployment.yaml b/k8s/helm/topfans/templates/moderationservice/deployment.yaml index f5ef356..d90d062 100644 --- a/k8s/helm/topfans/templates/moderationservice/deployment.yaml +++ b/k8s/helm/topfans/templates/moderationservice/deployment.yaml @@ -48,7 +48,7 @@ spec: livenessProbe: httpGet: path: {{ $svc.healthPath | default "/health" }} - port: {{ $svc.port }} + port: {{ $svc.healthPort | default $svc.port }} initialDelaySeconds: {{ $.Values.probes.defaultLiveness.initialDelaySeconds }} periodSeconds: {{ $.Values.probes.defaultLiveness.periodSeconds }} timeoutSeconds: {{ $.Values.probes.defaultLiveness.timeoutSeconds }} @@ -56,7 +56,7 @@ spec: readinessProbe: httpGet: path: {{ $svc.healthPath | default "/health" }} - port: {{ $svc.port }} + port: {{ $svc.healthPort | default $svc.port }} initialDelaySeconds: {{ $.Values.probes.defaultReadiness.initialDelaySeconds }} periodSeconds: {{ $.Values.probes.defaultReadiness.periodSeconds }} timeoutSeconds: {{ $.Values.probes.defaultReadiness.timeoutSeconds }} diff --git a/k8s/helm/topfans/templates/notificationservice/deployment.yaml b/k8s/helm/topfans/templates/notificationservice/deployment.yaml index 31e9b35..a5cdab1 100644 --- a/k8s/helm/topfans/templates/notificationservice/deployment.yaml +++ b/k8s/helm/topfans/templates/notificationservice/deployment.yaml @@ -48,7 +48,7 @@ spec: livenessProbe: httpGet: path: {{ $svc.healthPath | default "/health" }} - port: {{ $svc.port }} + port: {{ $svc.healthPort | default $svc.port }} initialDelaySeconds: {{ $.Values.probes.defaultLiveness.initialDelaySeconds }} periodSeconds: {{ $.Values.probes.defaultLiveness.periodSeconds }} timeoutSeconds: {{ $.Values.probes.defaultLiveness.timeoutSeconds }} @@ -56,7 +56,7 @@ spec: readinessProbe: httpGet: path: {{ $svc.healthPath | default "/health" }} - port: {{ $svc.port }} + port: {{ $svc.healthPort | default $svc.port }} initialDelaySeconds: {{ $.Values.probes.defaultReadiness.initialDelaySeconds }} periodSeconds: {{ $.Values.probes.defaultReadiness.periodSeconds }} timeoutSeconds: {{ $.Values.probes.defaultReadiness.timeoutSeconds }} diff --git a/k8s/helm/topfans/templates/socialservice/deployment.yaml b/k8s/helm/topfans/templates/socialservice/deployment.yaml index 6d326e8..f5c9ede 100644 --- a/k8s/helm/topfans/templates/socialservice/deployment.yaml +++ b/k8s/helm/topfans/templates/socialservice/deployment.yaml @@ -48,7 +48,7 @@ spec: livenessProbe: httpGet: path: {{ $svc.healthPath | default "/health" }} - port: {{ $svc.port }} + port: {{ $svc.healthPort | default $svc.port }} initialDelaySeconds: {{ $.Values.probes.defaultLiveness.initialDelaySeconds }} periodSeconds: {{ $.Values.probes.defaultLiveness.periodSeconds }} timeoutSeconds: {{ $.Values.probes.defaultLiveness.timeoutSeconds }} @@ -56,7 +56,7 @@ spec: readinessProbe: httpGet: path: {{ $svc.healthPath | default "/health" }} - port: {{ $svc.port }} + port: {{ $svc.healthPort | default $svc.port }} initialDelaySeconds: {{ $.Values.probes.defaultReadiness.initialDelaySeconds }} periodSeconds: {{ $.Values.probes.defaultReadiness.periodSeconds }} timeoutSeconds: {{ $.Values.probes.defaultReadiness.timeoutSeconds }} diff --git a/k8s/helm/topfans/templates/statisticservice/deployment.yaml b/k8s/helm/topfans/templates/statisticservice/deployment.yaml index 205b2fb..068ff07 100644 --- a/k8s/helm/topfans/templates/statisticservice/deployment.yaml +++ b/k8s/helm/topfans/templates/statisticservice/deployment.yaml @@ -70,7 +70,7 @@ spec: livenessProbe: httpGet: path: {{ $svc.healthPath | default "/healthz" }} - port: {{ $svc.port }} + port: {{ $svc.healthPort | default $svc.port }} initialDelaySeconds: {{ $.Values.probes.defaultLiveness.initialDelaySeconds }} periodSeconds: {{ $.Values.probes.defaultLiveness.periodSeconds }} timeoutSeconds: {{ $.Values.probes.defaultLiveness.timeoutSeconds }} @@ -78,7 +78,7 @@ spec: readinessProbe: httpGet: path: {{ $svc.healthPath | default "/healthz" }} - port: {{ $svc.port }} + port: {{ $svc.healthPort | default $svc.port }} initialDelaySeconds: {{ $.Values.probes.defaultReadiness.initialDelaySeconds }} periodSeconds: {{ $.Values.probes.defaultReadiness.periodSeconds }} timeoutSeconds: {{ $.Values.probes.defaultReadiness.timeoutSeconds }} diff --git a/k8s/helm/topfans/templates/taskservice/deployment.yaml b/k8s/helm/topfans/templates/taskservice/deployment.yaml index b40fc2e..bfc2bc8 100644 --- a/k8s/helm/topfans/templates/taskservice/deployment.yaml +++ b/k8s/helm/topfans/templates/taskservice/deployment.yaml @@ -55,7 +55,7 @@ spec: livenessProbe: httpGet: path: {{ $svc.healthPath | default "/health" }} - port: {{ $svc.port }} + port: {{ $svc.healthPort | default $svc.port }} initialDelaySeconds: {{ $.Values.probes.defaultLiveness.initialDelaySeconds }} periodSeconds: {{ $.Values.probes.defaultLiveness.periodSeconds }} timeoutSeconds: {{ $.Values.probes.defaultLiveness.timeoutSeconds }} @@ -63,7 +63,7 @@ spec: readinessProbe: httpGet: path: {{ $svc.healthPath | default "/health" }} - port: {{ $svc.port }} + port: {{ $svc.healthPort | default $svc.port }} initialDelaySeconds: {{ $.Values.probes.defaultReadiness.initialDelaySeconds }} periodSeconds: {{ $.Values.probes.defaultReadiness.periodSeconds }} timeoutSeconds: {{ $.Values.probes.defaultReadiness.timeoutSeconds }} diff --git a/k8s/helm/topfans/templates/userservice/deployment.yaml b/k8s/helm/topfans/templates/userservice/deployment.yaml index a7d2bb1..992dd69 100644 --- a/k8s/helm/topfans/templates/userservice/deployment.yaml +++ b/k8s/helm/topfans/templates/userservice/deployment.yaml @@ -48,7 +48,7 @@ spec: livenessProbe: httpGet: path: {{ $svc.healthPath | default "/health" }} - port: {{ $svc.port }} + port: {{ $svc.healthPort | default $svc.port }} initialDelaySeconds: {{ $.Values.probes.defaultLiveness.initialDelaySeconds }} periodSeconds: {{ $.Values.probes.defaultLiveness.periodSeconds }} timeoutSeconds: {{ $.Values.probes.defaultLiveness.timeoutSeconds }} @@ -56,7 +56,7 @@ spec: readinessProbe: httpGet: path: {{ $svc.healthPath | default "/health" }} - port: {{ $svc.port }} + port: {{ $svc.healthPort | default $svc.port }} initialDelaySeconds: {{ $.Values.probes.defaultReadiness.initialDelaySeconds }} periodSeconds: {{ $.Values.probes.defaultReadiness.periodSeconds }} timeoutSeconds: {{ $.Values.probes.defaultReadiness.timeoutSeconds }} diff --git a/k8s/helm/topfans/values.yaml b/k8s/helm/topfans/values.yaml index 40ab996..e97490a 100644 --- a/k8s/helm/topfans/values.yaml +++ b/k8s/helm/topfans/values.yaml @@ -136,7 +136,7 @@ services: replicas: 2 port: 20000 healthPath: /health - healthPort: 20000 + healthPort: 21000 image: { repositoryName: userservice, tag: latest } resources: requests: { cpu: 100m, memory: 64Mi } @@ -150,7 +150,7 @@ services: replicas: 1 port: 20002 healthPath: /health - healthPort: 20002 + healthPort: 21002 image: { repositoryName: socialservice, tag: latest } resources: requests: { cpu: 100m, memory: 64Mi } @@ -166,7 +166,7 @@ services: replicas: 2 port: 20003 healthPath: /health - healthPort: 20003 + healthPort: 21003 image: { repositoryName: assetservice, tag: latest } resources: requests: { cpu: 100m, memory: 64Mi } @@ -181,7 +181,7 @@ services: replicas: 2 port: 20001 healthPath: /health - healthPort: 20001 + healthPort: 21001 image: { repositoryName: galleryservice, tag: latest } resources: requests: { cpu: 100m, memory: 64Mi } @@ -201,7 +201,7 @@ services: replicas: 1 port: 20004 healthPath: /health - healthPort: 20004 + healthPort: 21004 image: { repositoryName: activityservice, tag: latest } resources: requests: { cpu: 100m, memory: 32Mi } @@ -215,7 +215,7 @@ services: replicas: 1 port: 20006 healthPath: /health - healthPort: 20006 + healthPort: 21006 image: { repositoryName: taskservice, tag: latest } resources: requests: { cpu: 100m, memory: 64Mi } @@ -234,7 +234,7 @@ services: replicas: 1 port: 20008 healthPath: /health - healthPort: 20008 + healthPort: 21008 image: { repositoryName: aichatservice, tag: latest } resources: requests: { cpu: 250m, memory: 256Mi } @@ -253,7 +253,7 @@ services: replicas: 1 port: 20009 healthPath: /healthz - healthPort: 20009 + healthPort: 21009 image: { repositoryName: statisticservice, tag: latest } resources: requests: { cpu: 100m, memory: 128Mi } @@ -276,7 +276,7 @@ services: replicas: 1 port: 20010 healthPath: /health - healthPort: 20010 + healthPort: 21010 image: { repositoryName: notificationservice, tag: latest } resources: requests: { cpu: 100m, memory: 128Mi } @@ -297,7 +297,7 @@ services: replicas: 1 port: 20011 healthPath: /health - healthPort: 20011 + healthPort: 21011 image: { repositoryName: moderationservice, tag: latest } resources: requests: { cpu: 100m, memory: 128Mi }