Helm으로 Konnect에 Kong Gateway 설치
Helm으로 Konnect에 Kong Gateway 설치 (Install Kong Gateway in Konnect with Helm)
이 문서는 Helm 차트를 사용해 Konnect에 Kong Gateway를 설치하는 방법을 단계별로 안내해요. Konnect 계정 준비부터 인증서 생성, Control Plane 만들기, 그리고 values.yaml 파일 작성까지 차례대로 따라 해봐요. 마지막에는 helm install 명령 한 줄로 Data Plane을 배포해서 Konnect와 연결까지 완료할 수 있어요
출처: 문서
본문
TL;DR
Helm으로 Konnect에 Kong Gateway를 어떻게 설치하나요?
Konnect에서 Control Plane을 만들고, values.yaml 파일에 Control Plane 세부 정보를 채운 다음, helm install kong kong/kong --values ./values.yaml -n kong --create-namespace를 실행해요.
Konnect 설정
Konnect 계정이 아직 없다면, 온보딩 마법사를 통해 빠르게 시작할 수 있어요.
-
이 튜토리얼을 완료하려면 다음 Konnect 항목들이 필요해요:
- 개인 액세스 토큰(PAT): Konnect PAT 페이지를 열고 Generate Token을 선택해서 새 개인 액세스 토큰을 만드세요.
-
개인 액세스 토큰을 환경 변수로 설정하세요:
export KONNECT_TOKEN='YOUR KONNECT TOKEN'
Helm 설정
helm repo add kong https://charts.konghq.com
helm repo update
인증서 생성
인증서와 키를 만들어요:
openssl req -new -x509 -nodes -newkey ec:<(openssl ecparam -name secp384r1) -keyout ./tls.key -out ./tls.crt -days 1095 -subj "/CN=kong_clustering"
인증서가 담긴 Secret을 만들어요:
kubectl create namespace kong
kubectl create secret tls kong-cluster-cert --cert=./tls.crt --key=./tls.key -n kong
Control Plane 생성
Konnect에서는 API 요청 한 번으로 Control Plane을 만들 수 있어요.
Control Plane을 만들고, 나중에 사용할 수 있도록 세부 정보를 저장해 두세요:
CONTROL_PLANE_DETAILS=$(curl -X POST "https://us.api.konghq.com/v2/control-planes" \
--no-progress-meter --fail-with-body \
-H "Authorization: Bearer $KONNECT_TOKEN" \
--json '{
"name": "demo-control-plane"
}'
)
이 Control Plane에 인증서를 업로드해요:
CONTROL_PLANE_ID=$(echo $CONTROL_PLANE_DETAILS | jq -r .id)
CERT=$(awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' tls.crt);
curl -X POST "https://us.api.konghq.com/v2/control-planes/$CONTROL_PLANE_ID/dp-client-certificates" \
--no-progress-meter --fail-with-body \
-H "Authorization: Bearer $KONNECT_TOKEN" \
--json '{
"cert": "'$CERT'"
}'
Data Plane 배포
나중에 사용하기 위해 Control Plane ID와 텔레메트리 엔드포인트를 export해 두세요:
CONTROL_PLANE_ENDPOINT=$(echo $CONTROL_PLANE_DETAILS | jq -r '.config.control_plane_endpoint | sub("https://";"")')
CONTROL_PLANE_TELEMETRY=$(echo $CONTROL_PLANE_DETAILS | jq -r '.config.telemetry_endpoint | sub("https://";"")')
다음 내용으로 values-dp.yaml 파일을 만들고, 3.16은 여러분이 사용하는 Kong Gateway 버전으로 바꾸세요:
echo '
ingressController:
enabled: false
image:
repository: kong/kong-gateway
tag: "3.16"
# Mount the secret created earlier
secretVolumes:
- kong-cluster-cert
env:
# data_plane nodes do not have a database
role: data_plane
database: "off"
konnect_mode: 'on'
vitals: "off"
cluster_mtls: pki
cluster_control_plane: "'$CONTROL_PLANE_ENDPOINT'"
cluster_telemetry_endpoint: "'$CONTROL_PLANE_TELEMETRY':443"
cluster_telemetry_server_name: "'$CONTROL_PLANE_TELEMETRY'"
cluster_cert: /etc/secrets/kong-cluster-cert/tls.crt
cluster_cert_key: /etc/secrets/kong-cluster-cert/tls.key
lua_ssl_trusted_certificate: system
proxy_access_log: "off"
dns_stale_ttl: "3600"
resources:
requests:
cpu: 1
memory: "2Gi"
secretVolumes:
- kong-cluster-cert
# The data plane handles proxy traffic only
proxy:
enabled: true
admin:
enabled: false
manager:
enabled: false
' > values-dp.yaml
values-dp.yaml을 사용해서 Data Plane을 배포해요:
helm install kong kong/kong --values ./values-dp.yaml -n kong --create-namespace
FAQ
-
클러스터 권한 없이 Helm으로 Kong Gateway를 설치할 수 있나요? 네.
kong차트를 사용할 때ingressController.rbac.enableClusterRoles를 false로 설정하면 돼요.경고: 컨트롤러가 클러스터 범위의 리소스를 감시해야 하기 때문에, 일부 리소스는 조정(reconciliation)을 위해 ClusterRole이 필요해요. ClusterRole을 비활성화하면 이런 리소스들이 실패하기 때문에,
false로 설정할 때는 해당 컨트롤러들도 함께 비활성화해야 해요. 여기에 해당하는 리소스는 다음과 같아요:- 모든 Gateway API 리소스
IngressClassKNative/Ingress(KIC 2.x만 해당)KongClusterPluginKongVault,KongLicense(KIC 3.1 이상)
다음 단계
더 알아보기 (Learn more)
- 아직 Konnect 계정이 없다면 온보딩 마법사로 빠르게 가입하고 시작할 수 있어요 — onboarding wizard
- 이 튜토리얼에서 필요한 개인 액세스 토큰(PAT)을 발급받을 수 있는 페이지예요 — Konnect PAT page
- 설치를 마쳤다면 Gateway Service에 요청 속도 제한을 적용하는 방법을 이어서 배워 볼 수 있어요 — Rate limit a Gateway Service
- 키 인증을 추가해서 설치한 Gateway Service의 보안을 강화하는 다음 단계 튜토리얼이에요 — Enable key authentication on a Gateway Service