덤프 서버
덤프 서버 (Dump server)
덤프 서버는 Kong Operator에서 각 ControlPlane에 생성된 Kong 구성을 그대로 들여다볼 수 있는 진단 기능이에요. Kubernetes 리소스가 어떻게 Kong 구성으로 변환되는지 궁금하거나 구성 문제를 디버깅할 때 특히 유용해요. 이 문서에서는 덤프 서버 활성화 방법부터 샘플 ControlPlane 만들기, 구성 덤프와 활용 예제, 문제 해결 팁까지 차근차근 안내해 드릴게요
출처: 문서
본문
dump config 서버는 Kong Operator의 진단 기능으로, 각 ControlPlane에 대해 생성된 Kong 구성을 살펴볼 수 있게 해줘요. 구성 문제를 디버깅하거나 Kubernetes 리소스가 Kong 구성으로 어떻게 변환되는지 이해하고 싶을 때 특히 유용해요.
dump config 서버 활성화하기
dump config 서버는 기본적으로 비활성화되어 있어요. Kong Operator를 설치하거나 업그레이드할 때 직접 활성화해야 해요.
설치 시 values를 설정해서 dump config 서버를 활성화하세요:
CLI
helm upgrade --install kong-operator kong/kong-operator \
--set enableControlplaneConfigDump=true \
--set controlplaneConfigDumpPort=10256 \
--namespace kong-system \
--create-namespace
Values 파일
values 파일을 만들어요:
# operator-values.yaml
enableControlplaneConfigDump: true
controlplaneConfigDumpPort: 10256 # Optional: defaults to 10256
그다음 아래 명령으로 설치해요:
helm upgrade --install kong-operator kong/kong-operator \
-f operator-values.yaml \
--namespace kong-system \
--create-namespace
dump config 서비스가 생성됐는지 확인해요:
kubectl get service -n kong-system kong-operator-kong-operator-config-dump
출력에 다음 내용이 표시돼야 해요:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kong-operator-kong-operator-config-dump ClusterIP 10.96.100.150 <none> 10256/TCP 1m
샘플 ControlPlane 만들기
최신 v2beta1 API를 사용해 최소한의 ControlPlane을 만들고, ControlPlane별 config dump를 활성화해요.
apiVersion: gateway-operator.konghq.com/v2beta1
kind: ControlPlane
metadata:
name: controlplane-v2
spec:
ingressClass: kong # required when dataplane.type is ref. Only Ingress supported
dataplane:
type: ref
ref:
name: dataplane-v2
featureGates:
- name: GatewayAlpha
state: enabled
configDump:
state: enabled
---
apiVersion: gateway-operator.konghq.com/v1beta1
kind: DataPlane
metadata:
name: dataplane-v2
spec:
deployment:
podTemplateSpec:
metadata:
labels:
dataplane-pod-label: example
annotations:
dataplane-pod-annotation: example
spec:
containers:
- name: proxy
image: kong:3.9
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "1024Mi"
cpu: "1000m"
readinessProbe:
initialDelaySeconds: 1
periodSeconds: 1
network:
services:
ingress:
annotations:
foo: bar
파일로 저장한 다음 클러스터에 적용해요:
kubectl apply -f cp-dp-v2.yaml
ControlPlane이 준비될 때까지 기다릴 수 있어요:
kubectl wait --for=condition=Ready controlplane controlplane-v2
kubectl get controlplane controlplane-v2
출력은 다음과 같아요:
NAME AGE READY
controlplane-v2 4m True
dump config 서버에 접근하기
dump config 서버는 기본적으로 외부에 노출되지 않아요. 포트 포워딩을 사용해 로컬에서 접근하세요:
kubectl port-forward -n kong-system service/kong-operator-kong-operator-config-dump 10256:10256
dump config 서버를 사용하는 동안 이 터미널은 열어두세요.
관리 중인 컨트롤 플레인 목록 조회하기
오퍼레이터가 관리하는 모든 컨트롤 플레인을 보려면:
curl http://localhost:10256/debug/controlplanes | jq .
응답 예시는 다음과 같아요:
{
"controlPlanes": [
{
"namespace": "default",
"name": "controlplane-v2",
"id": "e40e8e10-6f3c-4e05-95a1-b1896eb09eaf"
}
]
}
네임스페이스로 필터링하기
특정 네임스페이스의 컨트롤 플레인을 나열하려면:
curl http://localhost:10256/debug/controlplanes/namespace/default | jq .
ControlPlane 구성 덤프하기
특정 ControlPlane의 Kong 구성을 살펴보려면:
# Replace with your ControlPlane's namespace and name
curl http://localhost:10256/debug/controlplanes/namespace/default/name/controlplane-v2/config/successful
이 명령은 Kong Admin API로 전송될 원본 Kong 구성을 반환해요.
다음과 같이 보여요:
{
"hash": "hash id of the configuration",
"config": {
"_format_version": "3.0",
"_info": {
"select_tags": [
"managed-by-ingress-controller"
],
"defaults": {}
},
"upstreams": [
{
"name": "kong"
}
]
}
}
구성 보기 좋게 출력하기
가독성을 높이려면 출력을 jq로 파이프하세요:
curl -s http://localhost:10256/debug/controlplanes/namespace/default/name/controlplane-v2/config/successful | jq .
구성을 파일로 저장하기
나중에 분석할 수 있게 구성을 저장하려면:
curl -s http://localhost:10256/debug/controlplanes/namespace/default/name/controlplane-v2/config/successful \
> controlplane-config-$(date +%Y%m%d-%H%M%S).json
예제
구성 변경 모니터링하기
시간에 따른 구성 크기를 모니터링하는 스크립트를 만들어요:
#!/bin/bash
# monitor-config-size.sh
NAMESPACE="default"
NAME="controlplane-v2"
INTERVAL=60 # seconds
echo "Monitoring ControlPlane $NAMESPACE/$NAME configuration size..."
echo "Timestamp,Size(bytes)"
while true; do
SIZE=$(curl -s "http://localhost:10256/debug/controlplanes/namespace/$NAMESPACE/name/$NAME/config/successful" | wc -c)
TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S")
echo "$TIMESTAMP,$SIZE"
sleep $INTERVAL
done
구성 비교하기
두 컨트롤 플레인의 구성을 비교하려면:
# Dump both configurations
curl -s http://localhost:10256/debug/controlplanes/namespace/default/name/cp1/config/successful > cp1.json
curl -s http://localhost:10256/debug/controlplanes/namespace/default/name/cp2/config/successful > cp2.json
# Compare them (requires jq and diff)
diff <(jq -S . cp1.json) <(jq -S . cp2.json)
문제 해결
컨트롤 플레인을 찾을 수 없음
"ControlPlane not found" 오류가 발생하면:
-
ControlPlane이 존재하는지 확인해요:
kubectl get controlplanes -A -
오퍼레이터가 해당 리소스를 관리하는지 확인해요:
kubectl logs -n kong-system deployment/kong-operator-controller-manager | grep "your-controlplane-name" -
URL에 올바른 네임스페이스와 이름을 사용하고 있는지 확인하세요.
컨트롤 플레인에 config dump가 활성화되지 않은 경우
"control plane does not enable config dump" 메시지가 표시되면:
컨트롤 플레인이 존재하지만 개별 컨트롤 플레인 수준에서는 config dump가 활성화되지 않았다는 뜻이에요. 이 설정은 컨트롤 플레인별 설정이라서 전역 오퍼레이터 설정과는 별도로 구성해야 할 수 있어요.
다음 명령어로 config dump 구성을 확인할 수 있어요:
kubectl get controlplane controlplane-v2 -o jsonpath='{.spec.configDump}'
출력은 다음과 같고, state 필드가 "enabled"로 설정되어 있어야 해요:
{"dumpSensitive":"disabled","state":"enabled"}
구성이 비어 있거나 최소일 때
구성이 비어 있거나 지나치게 적어 보이면:
-
컨트롤 플레인 상태를 확인해요:
kubectl get controlplane -n default my-controlplane -o jsonpath='{.status.conditions}' | jq . -
이 컨트롤 플레인에 대해 구성된 라우트나 서비스가 있는지 확인해요.
-
오퍼레이터 로그에 오류가 있는지 확인해요:
kubectl logs -n kong-system deployment/kong-operator-kong-operator-controller-manager --tail=50
보안 고려 사항
dump config 서버는 서비스 엔드포인트와 라우팅 규칙을 포함해 잠재적으로 민감한 구성 데이터를 노출해요. 프로덕션 환경에서는 항상 적절한 네트워크 정책과 RBAC를 사용해 dump config 서비스에 대한 접근을 제한하세요.
다음 보안 실천 사항을 고려하세요:
- NetworkPolicies를 사용해 어떤 파드가 dump config 서비스에 접근할 수 있는지 제한해요
- RBAC를 구현해 누가 서비스로 포트 포워딩할 수 있는지 제어해요
- 서비스를 외부에 노출하지 않도록 LoadBalancer나 Ingress 사용은 피하세요
- 감사 로그를 통해 dump config 엔드포인트에 대한 접근을 모니터링해요
자주 묻는 질문(FAQ)
- 내 컨트롤 플레인에 대해 생성된 Kong 구성은 어떻게 살펴볼 수 있나요? Kong Operator를 설치할 때 dump config 서버를 활성화한 다음, 디버깅과 문제 해결을 위해 진단 엔드포인트로 구성을 살펴보세요.
관련 리소스
더 알아보기 (Learn more)
- 설치 시 사용하는 CLI 인자와 설정 옵션을 자세히 살펴보고 싶을 때 참고해요 — CLI arguments reference
- ControlPlane 상태에 문제가 생겼을 때 원인 파악과 해결 방법을 확인할 수 있어요 — Troubleshooting control plane status