서비스가 외부 엔드포인트와 통신하도록 허용
서비스가 외부 엔드포인트와 통신하도록 허용 (MeshPassthrough)
MeshPassthrough 정책을 사용하면 메시 안의 일부 서비스만 골라서 특정 외부 엔드포인트와 통신할 수 있어요. Dataplane에 라벨 기반 targetRef를 지정하고, 도메인·IP·CIDR 단위로 프로토콜과 포트까지 정해서 passthrough를 허용하는 방식이에요. 이 문서에서는 Kubernetes, Universal, Terraform 세 가지 환경에서의 설정 예제를 v2.8+ 기준으로 소개해요
출처: 문서
본문
서비스가 외부 엔드포인트와 통신하도록 허용하기v2.8+
일부 서비스가 특정 외부 엔드포인트와 통신하도록 허용해요
구성
Kubernetes
apiVersion: kuma.io/v1alpha1
kind: MeshPassthrough
metadata:
name: allow-some-passthrough
namespace: kong-mesh-system
labels:
kuma.io/mesh: default
spec:
targetRef:
kind: Dataplane
labels:
app: demo-app
default:
passthroughMode: Matched
appendMatch:
- type: Domain
value: httpbin.org
protocol: tls
port: 443
- type: IP
value: 10.240.15.39
protocol: tcp
port: 8888
- type: CIDR
value: 10.250.0.0/16
protocol: tcp
port: 10000
- type: Domain
value: "*.wikipedia.org"
protocol: tls
port: 443
- type: Domain
value: httpbin.dev
protocol: http
port: 80
Universal
type: MeshPassthrough
name: allow-some-passthrough
mesh: default
spec:
targetRef:
kind: Dataplane
labels:
app: demo-app
default:
passthroughMode: Matched
appendMatch:
- type: Domain
value: httpbin.org
protocol: tls
port: 443
- type: IP
value: 10.240.15.39
protocol: tcp
port: 8888
- type: CIDR
value: 10.250.0.0/16
protocol: tcp
port: 10000
- type: Domain
value: "*.wikipedia.org"
protocol: tls
port: 443
- type: Domain
value: httpbin.dev
protocol: http
port: 80
Terraform
현재 구성에 맞게 konnect_mesh_control_plane.my_meshcontrolplane.id와 konnect_mesh.my_mesh.name을 조정하세요. {: .text-sm}
resource "konnect_mesh_passthrough" "allow_some_passthrough" {
provider = konnect-beta
type = "MeshPassthrough"
name = "allow-some-passthrough"
spec = {
target_ref = {
kind = "Dataplane"
labels = {
app = "demo-app"
}
}
default = {
passthrough_mode = "Matched"
append_match = [
{
type = "Domain"
value = "httpbin.org"
protocol = "tls"
port = "443"
},
{
type = "IP"
value = "10.240.15.39"
protocol = "tcp"
port = "8888"
},
{
type = "CIDR"
value = "10.250.0.0/16"
protocol = "tcp"
port = "10000"
},
{
type = "Domain"
value = "*.wikipedia.org"
protocol = "tls"
port = "443"
},
{
type = "Domain"
value = "httpbin.dev"
protocol = "http"
port = "80"
}
]
}
}
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)
이 문서에는 원문에서 추출한 별도의 관련 문서 링크가 없어요.