Jelajahi Sumber

fix: add imagePullSecrets, change to servlet mode, add tcpSocket startupProbes, fix health check paths

Builder 2 bulan lalu
induk
melakukan
aa638b6771

+ 7 - 0
k8s/helm/shop-recycle/templates/configmap-gateway.yaml

@@ -17,6 +17,11 @@ data:
       cloud:
         compatibility-verifier:
           enabled: false
+        discovery:
+          enabled: false
+        service-registry:
+          auto-registration:
+            enabled: false
         gateway:
           routes:
             - id: order-service
@@ -50,6 +55,8 @@ data:
       eureka:
         client:
           enabled: false
+        instance:
+          prefer-ip-address: false
 
     management:
       endpoints:

+ 8 - 1
k8s/helm/shop-recycle/templates/configmap-order-service.yaml

@@ -11,15 +11,22 @@ data:
   application.yml: |
     spring:
       main:
-        web-application-type: servlet
+        web-application-type: reactive
       application:
         name: shop-recycle-order-service
       cloud:
         compatibility-verifier:
           enabled: false
+        discovery:
+          enabled: false
+        service-registry:
+          auto-registration:
+            enabled: false
       eureka:
         client:
           enabled: false
+        instance:
+          prefer-ip-address: false
 
     server:
       port: {{ .Values.orderService.service.port }}

+ 8 - 1
k8s/helm/shop-recycle/templates/configmap-payment-service.yaml

@@ -11,15 +11,22 @@ data:
   application.yml: |
     spring:
       main:
-        web-application-type: servlet
+        web-application-type: reactive
       application:
         name: shop-recycle-payment-service
       cloud:
         compatibility-verifier:
           enabled: false
+        discovery:
+          enabled: false
+        service-registry:
+          auto-registration:
+            enabled: false
       eureka:
         client:
           enabled: false
+        instance:
+          prefer-ip-address: false
 
     server:
       port: {{ .Values.paymentService.service.port }}

+ 2 - 0
k8s/helm/shop-recycle/templates/deployment-gateway.yaml

@@ -25,6 +25,8 @@ spec:
     spec:
       {{- if .Values.rbac.create }}
       serviceAccountName: {{ include "shop-recycle.serviceAccountName" . }}
+      imagePullSecrets:
+        - name: shop-recycle-registry-secret
       {{- end }}
       {{- if or .Values.global.registry.createSecret .Values.global.imagePullSecrets }}
       imagePullSecrets:

+ 3 - 1
k8s/helm/shop-recycle/templates/deployment-order-service.yaml

@@ -25,6 +25,8 @@ spec:
     spec:
       {{- if .Values.rbac.create }}
       serviceAccountName: {{ include "shop-recycle.serviceAccountName" . }}
+      imagePullSecrets:
+        - name: shop-recycle-registry-secret
       {{- end }}
 
       containers:
@@ -48,7 +50,7 @@ spec:
               value: "file:///etc/config/application.yml"
 
             - name: SPRING_MAIN_WEB_APPLICATION_TYPE
-              value: "reactive"
+              value: "servlet"
 
             - name: LOGGING_LEVEL_ROOT
               value: "INFO"

+ 5 - 1
k8s/helm/shop-recycle/templates/deployment-payment-service.yaml

@@ -25,6 +25,10 @@ spec:
     spec:
       {{- if .Values.rbac.create }}
       serviceAccountName: {{ include "shop-recycle.serviceAccountName" . }}
+      imagePullSecrets:
+        - name: shop-recycle-registry-secret
+      imagePullSecrets:
+        - name: shop-recycle-registry-secret
       {{- end }}
 
       containers:
@@ -48,7 +52,7 @@ spec:
               value: "file:///etc/config/application.yml"
 
             - name: SPRING_MAIN_WEB_APPLICATION_TYPE
-              value: "reactive"
+              value: "servlet"
 
             - name: LOGGING_LEVEL_ROOT
               value: "INFO"

+ 2 - 0
k8s/helm/shop-recycle/templates/deployment-web.yaml

@@ -21,6 +21,8 @@ spec:
     spec:
       {{- if .Values.rbac.create }}
       serviceAccountName: {{ include "shop-recycle.serviceAccountName" . }}
+      imagePullSecrets:
+        - name: shop-recycle-registry-secret
       {{- end }}
       {{- if or .Values.global.registry.createSecret .Values.global.imagePullSecrets }}
       imagePullSecrets:

+ 22 - 39
k8s/helm/shop-recycle/values.yaml

@@ -62,7 +62,7 @@ gateway:
   # 健康检查
   livenessProbe:
     httpGet:
-      path: /health
+      path: /actuator/health
       port: 8080
     initialDelaySeconds: 30
     periodSeconds: 10
@@ -71,7 +71,7 @@ gateway:
   
   readinessProbe:
     httpGet:
-      path: /health
+      path: /actuator/health
       port: 8080
     initialDelaySeconds: 20
     periodSeconds: 5
@@ -81,14 +81,12 @@ gateway:
   # 服务配置
   # 启动探针 - 给 Java 应用充分的启动时间(5分钟才开始检查)
   startupProbe:
-    httpGet:
-      path: /health
+    tcpSocket:
       port: 8080
-    initialDelaySeconds: 300
-    periodSeconds: 10
-    timeoutSeconds: 5
-    failureThreshold: 60
-
+    initialDelaySeconds: 0
+    periodSeconds: 5
+    timeoutSeconds: 2
+    failureThreshold: 120
   service:
     type: ClusterIP
     port: 8080
@@ -170,15 +168,10 @@ orderService:
   
   javaOpts: "-Xms256m -Xmx512m -XX:+UseG1GC"
   springProfiles: "kubernetes"
-
-  # 环境变量
-  env:
-    SPRING_CONFIG_LOCATION: "file:///etc/config/application.yml"
-    SPRING_MAIN_WEB_APPLICATION_TYPE: "reactive"
   
   livenessProbe:
     httpGet:
-      path: /health
+      path: /actuator/health
       port: 8081
     initialDelaySeconds: 30
     periodSeconds: 10
@@ -187,7 +180,7 @@ orderService:
   
   readinessProbe:
     httpGet:
-      path: /health
+      path: /actuator/health
       port: 8081
     initialDelaySeconds: 20
     periodSeconds: 5
@@ -196,14 +189,12 @@ orderService:
   
   # 启动探针 - 给 Java 应用充分的启动时间(5分钟才开始检查)
   startupProbe:
-    httpGet:
-      path: /health
+    tcpSocket:
       port: 8081
-    initialDelaySeconds: 300
-    periodSeconds: 10
-    timeoutSeconds: 5
-    failureThreshold: 60
-
+    initialDelaySeconds: 0
+    periodSeconds: 5
+    timeoutSeconds: 2
+    failureThreshold: 120
   service:
     type: ClusterIP
     port: 8081
@@ -239,15 +230,10 @@ paymentService:
   
   javaOpts: "-Xms256m -Xmx512m -XX:+UseG1GC"
   springProfiles: "kubernetes"
-
-  # 环境变量
-  env:
-    SPRING_CONFIG_LOCATION: "file:///etc/config/application.yml"
-    SPRING_MAIN_WEB_APPLICATION_TYPE: "reactive"
   
   livenessProbe:
     httpGet:
-      path: /health
+      path: /actuator/health
       port: 8082
     initialDelaySeconds: 30
     periodSeconds: 10
@@ -256,7 +242,7 @@ paymentService:
   
   readinessProbe:
     httpGet:
-      path: /health
+      path: /actuator/health
       port: 8082
     initialDelaySeconds: 20
     periodSeconds: 5
@@ -264,15 +250,12 @@ paymentService:
     failureThreshold: 3
   # 启动探针 - 给 Java 应用充分的启动时间(5分钟才开始检查)
   startupProbe:
-    httpGet:
-      path: /health
+    tcpSocket:
       port: 8082
-    initialDelaySeconds: 300
-    periodSeconds: 10
-    timeoutSeconds: 5
-    failureThreshold: 60
-
-  
+    initialDelaySeconds: 0
+    periodSeconds: 5
+    timeoutSeconds: 2
+    failureThreshold: 120
   service:
     type: ClusterIP
     port: 8082
@@ -308,7 +291,7 @@ webFrontend:
   
   livenessProbe:
     httpGet:
-      path: /health
+      path: /actuator/health
       port: 80
     initialDelaySeconds: 10
     periodSeconds: 10