diff --git a/k8s/aws/31-petclinic-ingress.yaml b/k8s/aws/31-petclinic-ingress.yaml index b81bceaa2..748a3abc8 100644 --- a/k8s/aws/31-petclinic-ingress.yaml +++ b/k8s/aws/31-petclinic-ingress.yaml @@ -9,8 +9,8 @@ metadata: alb.ingress.kubernetes.io/target-type: ip alb.ingress.kubernetes.io/listen-ports: '[{"HTTP":80}]' - # 헬스체크 설정 - alb.ingress.kubernetes.io/healthcheck-path: /actuator/health/liveness + # 헬스체크 설정 LB전용 HealthCheck + alb.ingress.kubernetes.io/healthcheck-path: /healthz-lb alb.ingress.kubernetes.io/healthcheck-port: traffic-port alb.ingress.kubernetes.io/healthcheck-protocol: HTTP @@ -19,6 +19,14 @@ spec: rules: - http: paths: + #LB 헬스체크 전용 + - path: /healthz-lb + pathType: Prefix + backend: + service: + name: lb-health + port: + number: 80 - path: / pathType: Prefix backend: diff --git a/k8s/aws/99-lb-healthCheck.yaml b/k8s/aws/99-lb-healthCheck.yaml new file mode 100644 index 000000000..d0ddd4007 --- /dev/null +++ b/k8s/aws/99-lb-healthCheck.yaml @@ -0,0 +1,41 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: lb-health + namespace: petclinic-ns +spec: + replicas: 1 + selector: + matchLabels: + app: lb-health + template: + metadata: + labels: + app: lb-health + spec: + containers: + - name: echo + image: hashicorp/http-echo + args: + - "-text=OK" + ports: + - containerPort: 5678 + resources: + requests: + cpu: "5m" + memory: "16Mi" + limits: + cpu: "10m" + memory: "32Mi" +--- +apiVersion: v1 +kind: Service +metadata: + name: lb-health + namespace: petclinic-ns +spec: + selector: + app: lb-health + ports: + - port: 80 + targetPort: 5678 diff --git a/k8s/gcp/31-petclinic-ingress.yaml b/k8s/gcp/31-petclinic-ingress.yaml index 1c8bec8f7..6f22afee3 100644 --- a/k8s/gcp/31-petclinic-ingress.yaml +++ b/k8s/gcp/31-petclinic-ingress.yaml @@ -1,5 +1,16 @@ apiVersion: cloud.google.com/v1 kind: BackendConfig +metadata: + name: lb-health-backendconfig + namespace: petclinic-ns +spec: + healthCheck: + type: HTTP + requestPath: /healthz-lb + port: 80 +--- +apiVersion: cloud.google.com/v1 +kind: BackendConfig metadata: name: petclinic-backendconfig namespace: petclinic-ns @@ -11,6 +22,20 @@ spec: --- apiVersion: v1 kind: Service +metadata: + name: lb-health + namespace: petclinic-ns + annotations: + beta.cloud.google.com/backend-config: '{"default":"lb-health-backendconfig"}' +spec: + selector: + app: lb-health + ports: + - port: 80 + targetPort: 5678 +--- +apiVersion: v1 +kind: Service metadata: name: petclinic namespace: petclinic-ns @@ -36,6 +61,14 @@ spec: rules: - http: paths: + # LB 헬스체크 전용 + - path: /healthz-lb + pathType: Prefix + backend: + service: + name: lb-health + port: + number: 80 - path: / pathType: Prefix backend: diff --git a/k8s/gcp/99-lb-healthCheck.yaml b/k8s/gcp/99-lb-healthCheck.yaml new file mode 100644 index 000000000..d0ddd4007 --- /dev/null +++ b/k8s/gcp/99-lb-healthCheck.yaml @@ -0,0 +1,41 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: lb-health + namespace: petclinic-ns +spec: + replicas: 1 + selector: + matchLabels: + app: lb-health + template: + metadata: + labels: + app: lb-health + spec: + containers: + - name: echo + image: hashicorp/http-echo + args: + - "-text=OK" + ports: + - containerPort: 5678 + resources: + requests: + cpu: "5m" + memory: "16Mi" + limits: + cpu: "10m" + memory: "32Mi" +--- +apiVersion: v1 +kind: Service +metadata: + name: lb-health + namespace: petclinic-ns +spec: + selector: + app: lb-health + ports: + - port: 80 + targetPort: 5678