본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

MeshHealthChecks: cart에서 payment 서비스로의 gRPC 헬스 체크

원문 보기 위키 갱신

MeshHealthChecks: cart에서 payment 서비스로의 gRPC 헬스 체크 (gRPC Health Check)

이 문서는 Kong Mesh의 MeshHealthCheck 정책으로 cart에서 payment 서비스 방향의 gRPC 헬스 체크를 구성하는 방법을 설명해요. Kubernetes와 Universal 환경에서 kuma.io/service 태그 기반 이름 방식과 MeshService 리소스 방식으로 대상을 지정하는 YAML 예제를 각각 보여줘요. 또한 Terraform을 사용해 Konnect에서 동일한 헬스 체크 정책을 정의하는 방법까지 다뤄요

출처: 문서

본문

cart에서 payment 서비스로의 gRPC 헬스 체크

cart에서 payment 서비스로의 gRPC 헬스 체크예요.

구성

Kubernetes

kuma.io/service 태그 기반 이름을 사용하는 경우:

apiVersion: kuma.io/v1alpha1
kind: MeshHealthCheck
metadata:
  name: web-to-backend-check
  namespace: kuma-demo
  labels:
    kuma.io/mesh: default
spec:
  targetRef:
    kind: Dataplane
    labels:
      app: web
  to:
  - targetRef:
      kind: MeshService
      name: backend_kuma-demo_svc_3001
    default:
      interval: 15s
      timeout: 5s
      unhealthyThreshold: 3
      healthyThreshold: 2
      grpc:
        serviceName: grpc.health.v1.CustomHealth

MeshService Kubernetes 리소스를 사용하는 경우:

apiVersion: kuma.io/v1alpha1
kind: MeshHealthCheck
metadata:
  name: web-to-backend-check
  namespace: kuma-demo
  labels:
    kuma.io/mesh: default
spec:
  targetRef:
    kind: Dataplane
    labels:
      app: web
  to:
  - targetRef:
      kind: MeshService
      name: backend
      namespace: kuma-demo
      sectionName: http
    default:
      interval: 15s
      timeout: 5s
      unhealthyThreshold: 3
      healthyThreshold: 2
      grpc:
        serviceName: grpc.health.v1.CustomHealth

Universal

kuma.io/service 태그 기반 이름을 사용하는 경우:

type: MeshHealthCheck
name: web-to-backend-check
mesh: default
spec:
  targetRef:
    kind: Dataplane
    labels:
      app: web
  to:
  - targetRef:
      kind: MeshService
      name: backend
    default:
      interval: 15s
      timeout: 5s
      unhealthyThreshold: 3
      healthyThreshold: 2
      grpc:
        serviceName: grpc.health.v1.CustomHealth

MeshService Kubernetes 리소스를 사용하는 경우:

type: MeshHealthCheck
name: web-to-backend-check
mesh: default
spec:
  targetRef:
    kind: Dataplane
    labels:
      app: web
  to:
  - targetRef:
      kind: MeshService
      name: backend
      sectionName: http
    default:
      interval: 15s
      timeout: 5s
      unhealthyThreshold: 3
      healthyThreshold: 2
      grpc:
        serviceName: grpc.health.v1.CustomHealth

Terraform

konnect_mesh_control_plane.my_meshcontrolplane.id와 konnect_mesh.my_mesh.name을 현재 구성에 맞게 조정하세요. {: .text-sm}

resource "konnect_mesh_health_check" "web_to_backend_check" {
  provider = konnect-beta
  type = "MeshHealthCheck"
  name = "web-to-backend-check"
  spec = {
    target_ref = {
      kind = "Dataplane"
      labels = {
        app = "web"
      }
    }
    to = [
      {
        target_ref = {
          kind = "MeshService"
          name = "backend"
          section_name = "http"
        }
        default = {
          interval = "15s"
          timeout = "5s"
          unhealthy_threshold = "3"
          healthy_threshold = "2"
          grpc = {
            service_name = "grpc.health.v1.CustomHealth"
          }
        }
      }
    ]
  }
  labels   = {
  "kuma.io/mesh" = konnect_mesh.my_mesh.name
  }
  cp_id    = konnect_mesh_control_plane.my_meshcontrolplane.id
  mesh     = konnect_mesh.my_mesh.name
}

더 알아보기 (Learn more)

이 문서에는 원문에서 추출한 별도의 관련 문서 링크가 없어요.