Kong Gateway 구성 백업
Kong Gateway 구성 백업 (deck gateway dump)
decK의 deck gateway dump 명령으로 실행 중인 Kong Gateway의 구성을 파일로 백업하는 방법을 소개해요. Konnect, 단일 Workspace, 전체 Workspace 등 환경에 따라 달라지는 명령 옵션을 차례로 설명해요. 민감한 정보를 해시로 가려주는 --sanitize 플래그의 동작 원리와 명령 사용법도 함께 확인할 수 있어요
출처: 문서
본문
백업할 수 있는 엔티티 구성이 무엇인지 알아보려면 decK가 관리하는 엔티티 참조 문서를 확인하세요.
워크스페이스(온프레미스 전용)를 사용하는지 여부에 따라 실행해야 하는 정확한 명령이 달라져요.
다음 명령은 모든 구성을 하나의 파일에 백업해요. 구성을 분할하는 방법을 알아보려면 태그를 확인하세요.
Konnect
decK는 Konnect에서 한 번에 하나의 컨트롤 플레인만 내보낼 수 있어요. 백업할 컨트롤 플레인을 선택하려면 --konnect-control-plane-name 플래그를 지정하세요:
deck gateway dump \
-o $YOUR_CP_NAME.yaml \
--konnect-control-plane-name $YOUR_CP_NAME \
--konnect-token $KONNECT_TOKEN
단일 워크스페이스
기본 워크스페이스를 사용하는 경우, decK가 백업할 워크스페이스를 자동으로 식별해요:
deck gateway dump -o kong.yaml
다른 워크스페이스를 백업하려면 -w 플래그를 전달하세요:
deck gateway dump -w $WORKSPACE_NAME -o $WORKSPACE_NAME.yaml
모든 워크스페이스
모든 워크스페이스를 백업하려면 --all-workspaces 플래그를 전달하세요.
그러면 현재 디렉터리에 여러 개의 파일이 생성돼요. 각 파일은 해당 워크스페이스와 같은 이름을 가져요:
deck gateway dump --all-workspaces
구성 새니타이제이션
deck gateway dump 명령에는 참조 무결성을 유지하면서 구성을 난독화하는 --sanitize 플래그가 포함되어 있어요. 새니타이즈된 파일은 deck gateway sync를 사용해 실행 중인 Kong Gateway에 적용할 수 있지만, 비공개 세부 정보는 사용할 수 없어요.
내부 서비스 이름이나 업스트림 타깃 같은 민감한 정보가 포함된 구성 파일을 공유할 때 이 플래그를 사용해야 해요.
새니타이제이션 작동 방식
이름, 태그, 사용자 이름, 비밀번호, 컨슈머 ID, 호스트명, 경로 같은 자유 형식 문자열은 연결된 엔티티 간의 일관된 참조를 보장하면서 원래 값이 유출되는 것을 막기 위해 해시 처리돼요.
인증서와 키처럼 특정 형식을 따라야 하는 구조화된 시크릿의 경우, 알고리즘이 해시 대신 고유한 모의 예시를 삽입해서 실제 값을 노출하지 않으면서 유효성 검사기를 통과할 수 있게 해요.
해시를 계산하기 위해 deck은 다음 프로세스를 사용해요:
- UUID 생성을 통해 무작위 솔트를 만들어요.
- 솔트를 문자열 값과 연결한 다음 sha256 해시를 생성해요.
- sha256 해시 결과에 hex 인코딩을 적용해요.
명령 사용법
Usage:
deck gateway dump [flags]
Flags:
--all-workspaces dump configuration of all Workspaces (Kong Enterprise only).
--consumer-group-policy-overrides allow deck to dump consumer-group policy overrides.
This allows policy overrides to work with Kong GW versions >= 3.4
Warning: do not mix with consumer-group scoped plugins
--format string output file format: json or yaml. (default "yaml")
-h, --help help for dump
--include-plugin-definitions allow deck to dump plugin definitions.
Plugin definitions work with Konnect and Gateway versions >= 3.15.
-o, --output-file - file to which to write Kong's configuration.Use - to write to stdout. (default "-")
--rbac-resources-only export only the RBAC resources (Kong Enterprise only).
--sanitize dumps a sanitized version of the gateway configuration.
This feature hashes passwords, keys and other sensitive details.
--select-tag strings only entities matching tags specified with this flag are exported.
When this setting has multiple tag values, entities must match every tag.
--skip-ca-certificates do not dump CA certificates.
--skip-consumers skip exporting consumers, consumer-groups and any plugins associated with them.
--skip-consumers-with-consumer-groups do not show the association between consumer and consumer-group.
If set to true, deck skips listing consumers with consumer-groups,
thus gaining some performance with large configs.
--skip-defaults skip exporting default values.
--with-id write ID of all entities in the output
-w, --workspace string dump configuration of a specific Workspace(Kong Enterprise only).
--yes yes assume yes to prompts and run non-interactively.
관련 리소스
더 알아보기 (Learn more)
- decK로 백업할 수 있는 엔티티 구성이 무엇인지 확인해요 — Entities managed by decK
- Workspace 개념을 이해하면 덤프 대상을 지정하는 방법이 명확해져요 — Workspaces
- 태그를 사용해 구성을 나눠서 백업하는 방법을 살펴봐요 — tags
- dump 외에 sync 같은 다른 deck gateway 명령도 함께 확인해요 — deck gateway commands