워크스페이스
워크스페이스 (Workspaces)
워크스페이스는 Kong Gateway 엔티티를 네임스페이스 단위로 분리해서 팀이 독립적으로 관리할 수 있게 해주는 기능이에요. RBAC와 함께 쓰면 컨트롤 플레인 안에 테넌트를 만들 수 있고, 워크스페이스 관리자는 Kong Manager·Admin API·decK에서 자기 영역의 설정에만 안전하게 접근할 수 있어요. 워크스페이스끼리는 Services 같은 엔티티를 공유할 수 없어서, 라우팅 충돌이 생기면 Kong Gateway가 충돌 감지 알고리즘으로 처리해요. 이 문서에서는 역할과 권한 관리, decK를 활용한 여러 워크스페이스 운영, 워크스페이스 설정 방법까지 함께 다뤄요
출처: 문서
본문
Workspace란 무엇일까요?
Workspace는 Kong Gateway 엔티티를 네임스페이싱해서 독립적으로 관리할 수 있게 해주는 방법이에요. Workspace는 RBAC과 결합하여 팀이 서로 독립적으로 운영할 수 있는 격리된 환경을 만들어 줘요. Workspace끼리는 Service 같은 엔티티를 공유할 수 없으며, 해당 Workspace 내에서 올바른 권한을 가진 Workspace Admin만 엔티티를 관리할 수 있어요.
Workspace는 Kong Gateway 구성 객체를 격리하는 방식으로 멀티 테넌시를 지원해요. RBAC과 함께 사용하면 Kong Gateway 관리자가 control plane 내에 테넌트를 효과적으로 만들 수 있어요. Workspace 관리자는 Kong Manager, Admin API, 선언형 구성 도구인 decK에서 Kong Gateway 구성 중 자신에게 해당하는 부분에만 격리되고 안전하게 접근할 수 있어요.
flowchart LR
subgraph Workspace1 [Workspace-1]
A(Team A's - Service)
B(Route)
end
subgraph Workspace2 [Workspace-2]
C(Team B's - Service)
D(Route)
end
subgraph Workspace3 [Workspace-3]
E(Team C's - Service)
F(Route)
end
subgraph Gatewayorg [Gateway Organization]
Workspace1
Workspace2
Workspace3
end
Kong Gateway는 Workspace 간 엔티티 충돌을 어떻게 해결할까요?
라우팅 규칙은 Data Plane 레벨에서 구성돼요. Data Plane은 모든 Workspace에 걸쳐 적용된 구성을 기반으로 클라이언트 트래픽을 라우팅해요. Gateway Service와 Route 같은 라우팅 관련 엔티티를 구성하면 Data Plane의 클라이언트 트래픽 라우팅 동작이 달라지지만, Kong Gateway는 항상 라우팅 규칙에 충돌이 없도록 보장하려고 해요.
트래픽을 적절한 Workspace로 라우팅하기 위해 Kong Gateway는 충돌 감지 알고리즘을 사용해요.
Service나 Route가 생성되거나 수정될 때, Kong Gateway Router는 작업이 진행되도록 허용하기 전에 다음 순서로 해당 객체의 존재 여부를 확인해요:
- 생성된 Service나 Route가 모든 Workspace에서 고유하면 새 엔티티가 생성돼요.
- 현재 Workspace에 있는 기존 Service나 Route 객체가 생성 또는 수정 중인 것과 동일한 라우팅 규칙을 가지고 있으면 작업이 진행돼요.
- 다른 Workspace에서 동등한 Service나 Route가 발견되고 host가 제공된 경우:
- 두 Workspace에서 host 필드가 일치하면
409 Conflict오류가 반환돼요. - host 필드가 일치하지 않으면 작업이 진행돼요.
- host가 절대값이면
409 Conflict오류가 반환돼요.
- 두 Workspace에서 host 필드가 일치하면
Kong Gateway의 충돌 설정은 kong.conf를 통해 조정할 수 있어요:
파라미터: enforce_route_path_pattern
parameter: enforce_route_path_pattern
default_value: none
description: |
route 객체의 paths 속성에 적용될
Lua 패턴을 지정해요. 패턴에 workspace용
플레이스홀더를 추가할 수도 있는데,
이는 런타임에 route가 속한
workspace를 기준으로 렌더링돼요.
이 설정은 route_validation_strategy가
path로 설정된 경우에만
의미가 있어요.
참고: 충돌 감지는 일반 텍스트 라우트만 지원해요. 정규식 라우트를 검증하는 데 이 기능을 사용하지 마세요.
예시
패턴 /$(workspace)/v%d/.*에서 유효한
경로는 다음과 같아요:
-
route가 workspace
group1에 속하는 경우/group1/v1/. -
route가 workspace
group2에 속하는 경우/group2/v1/some_path.
파라미터: route_validation_strategy
parameter: route_validation_strategy default_value: smart description: | route를 생성하거나 업데이트할 때 route를 검증하는 데 사용되는 전략이에요. workspace 간 트래픽 분배를 어떻게 강제할지 조정할 수 있는 다양한 전략이 마련되어 있어요.
smart는 기본 옵션으로, Kong workspace 문서에 설명된 알고리즘을 사용해요.off는 모든 검사를 비활성화해요.path는 configenforce_route_path_pattern에 설명된 패턴을 route가 따르도록 강제해요.static은 PostgreSQL 데이터베이스에 의존해요. 새 route를 생성하기 전에, 다음 파라미터를 기준으로 해당 route가 모든 workspace에서 고유한지 검사해요:paths,methods,hosts. 새 route의 모든 필드가 기존 route와 겹치면, 충돌이 발생한 route와 함께 409가 반환돼요. 겹침 필터에서 배열 순서는 중요하지 않아요.
참고: Route 충돌 감지는 표현식 기반 라우팅에서는 작동하지 않아요.
역할, 그룹, 권한
Workspace는 사용자가 Kong Gateway 엔티티를 격리된 상태로 제어할 수 있게 해주기 때문에, 특정 Workspace를 구성하려면 사용자에게 올바른 권한이 있어야 해요. 그러려면 사용자에게 내장된 Super Admin 역할이나 Admin 역할이 필요해요.
다음 표는 각 내장 역할이 어떤 Workspace 권한을 가지는지 자세히 보여줘요:
지정된 Workspace 내의 엔티티 관리
Super Admin: 지원 Admin: 지원
새 Workspace 생성
Super Admin: 지원 Admin: 지원 안 함
관리자에게 역할 할당 및 회수
Super Admin: 지원 Admin: 지원 안 함
조직 전체에서 모든 Workspace 관리
Super Admin: 지원 Admin: 지원 안 함
참고: Workspace 생성은 Workspace별 권한의 영향을 받지 않는 전역 작업이에요.
기본적으로 커스텀 역할은 단일 Workspace로 범위가 한정되며 새 Workspace를 만들 수 없어요.
커스텀 역할을 가진 사용자가 Workspace를 만들 수 있도록 하려면, Workspace를*(모든 Workspace)로 설정한 상태에서 역할 권한을 부여하는 Admin API를 사용하세요.
자세한 내용은 역할 및 권한을 참고하세요.
decK으로 Workspace 관리
decK을 사용해 Workspace와 연동할 때는 다음 decK 플래그를 반드시 사용해야 해요.
여러 Workspace 관리
모든 Workspace를 한 번에 관리하려면 decK에서 --all-workspaces 플래그를 사용하세요:
deck gateway dump --all-workspaces
그러면 default를 포함해 각 Workspace 이름이 붙은 개별 yaml 파일로 구성이 덤프돼요.
decK 파일 내에서 특정 Workspace를 다음과 같이 지정할 수도 있어요:
_format_version: "3.0"
_workspace: default
services:
- name: example_service
Workspace별 구성 배포
decK 구성은 Workspace별로 개별적으로 배포해야 해요. 이는 --workspace 플래그를 사용해서 할 수 있어요:
deck gateway sync default.yaml --workspace default
Workspace 구성 삭제
decK은 Workspace를 삭제할 수 없어요. 하지만 deck gateway reset을 --workspace 또는 --all-workspaces 플래그와 함께 사용하면 decK가 Workspace 자체가 아닌 Workspace 내부의 전체 구성을 삭제하도록 강제할 수 있어요.
Workspace 설정하기
Admin API
Workspace를 생성하려면 Admin API의 /workspaces 엔드포인트를 호출하세요.
curl -i -X POST http://localhost:8001/workspaces/ \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data '
{
"name": "my-workspace"
}
'
UI
다음은 새 Workspace를 생성하는 방법이에요:
- Kong Manager 대시보드에서 New Workspace를 클릭하세요.
- 이름을 입력한 다음 Create New Workspace를 클릭하세요.
새 Workspace가 생성되고, 여기서부터 Kong Manager에서 엔티티 관리를 시작할 수 있어요.
Workspace 이름 충돌 해결 v3.15+
Kong Gateway 3.15.0.0부터 최상위 Admin API route 세그먼트(services, routes, consumers 등)와 일치하는 Workspace 이름은 더 이상 허용되지 않아요.
Kong Gateway는 시작 시와 마이그레이션 실행 전에 이 검사를 수행해요.
충돌을 감지하면 Kong Gateway는 오류와 함께 종료되며, 충돌하는 모든 Workspace의 이름이 바뀔 때까지 시작되지 않아요.
3.15 이상을 실행 중이고 이름이 충돌하는 Workspace가 있다면, 다음 단계에 따라 구성을 업데이트하세요:
-
kong workspace유틸리티를 사용해서 다음 명령어를 실행해 이름이 충돌하는 모든 Workspace 목록을 확인하세요:kong workspace detect-admin-endpoint-conflicts구성에 충돌이 있으면 다음 메시지가 표시돼요:
The following workspace(s) have names that conflict with active admin API URL prefixes in this version of Kong: routes services Rename them with 'kong workspace rename OLD_NAME NEW_NAME'.{:.no-copy-code}
-
출력에 나온 각 Workspace에 대해 다음 명령어를 실행하세요:
kong workspace rename OLD_NAME NEW_NAMEOLD_NAME을 현재 Workspace 이름으로,NEW_NAME을 Admin API route 세그먼트와 충돌하지 않는 이름으로 바꾸세요. -
detect-admin-endpoint-conflicts명령어를 다시 실행해 충돌이 남아 있지 않은지 확인하세요:kong workspace detect-admin-endpoint-conflicts이제 다음이 표시될 거예요:
No workspaces conflict with active admin API endpoints.{:.no-copy-code}
모든 충돌이 해결되면 Kong Gateway를 시작하거나 마이그레이션을 실행할 수 있어요.
참고: Workspace 이름을 바꾼 후에는 실행 중인 Kong Gateway 노드가 캐시된 구성을 제공하므로, 데이터베이스를 다시 읽기 전까지는 변경 사항을 반영하지 않아요.
- 일반(하이브리드가 아닌) 배포에서는 모든 노드에서
kong restart또는kong reload를 실행하세요.- 하이브리드 배포에서는 각 control plane 노드에서
kong restart또는kong reload를 실행해 데이터베이스를 다시 읽도록 하세요.Data Plane은 수동으로 재시작할 필요가 없어요. control plane이 새로고침되면 자동으로 업데이트돼요.
스키마
{
"additionalProperties": false,
"example": {
"comment": "Example workspace comment",
"config": {
"meta": {},
"portal": false,
"portal_access_request_email": true,
"portal_application_request_email": true,
"portal_application_status_email": true,
"portal_approved_email": true,
"portal_auth": "basic",
"portal_auth_conf": "some-auth-config",
"portal_auto_approve": true,
"portal_cors_origins": [
"https://example.com",
"https://another-origin.com"
],
"portal_developer_meta_fields": "[{\"label\":\"Full Name\",\"title\":\"full_name\",\"validator\":{\"required\":true,\"type\":\"string\"}}]",
"portal_emails_from": "admin@example.com",
"portal_emails_reply_to": "support@example.com",
"portal_invite_email": true,
"portal_is_legacy": false,
"portal_reset_email": true,
"portal_reset_success_email": true,
"portal_session_conf": "some-session-config",
"portal_smtp_admin_emails": [
"admin@example.com",
"dev@example.com"
],
"portal_token_exp": 3600
},
"created_at": 1706598432.0,
"id": "b58c7d9d-e54f-444c-b24d-cdfc4159f61e",
"meta": {
"color": "#ffcc00",
"thumbnail": "https://example.com/image.png"
},
"name": "example-workspace"
},
"properties": {
"comment": {
"description": "A description or additional information about the workspace.",
"nullable": true,
"type": "string"
},
"config": {
"nullable": true,
"properties": {
"meta": {
"additionalProperties": {
"type": "string"
},
"type": "object"
},
"portal": {
"default": false,
"type": "boolean"
},
"portal_access_request_email": {
"type": "boolean"
},
"portal_application_request_email": {
"type": "boolean"
},
"portal_application_status_email": {
"type": "boolean"
},
"portal_approved_email": {
"type": "boolean"
},
"portal_auth": {
"type": "string"
},
"portal_auth_conf": {
"type": "string"
},
"portal_auto_approve": {
"type": "boolean"
},
"portal_cors_origins": {
"items": {
"type": "string"
},
"type": "array"
},
"portal_developer_meta_fields": {
"default": "[{\"label\":\"Full Name\",\"title\":\"full_name\",\"validator\":{\"required\":true,\"type\":\"string\"}}]",
"type": "string"
},
"portal_emails_from": {
"type": "string"
},
"portal_emails_reply_to": {
"type": "string"
},
"portal_invite_email": {
"type": "boolean"
},
"portal_is_legacy": {
"type": "boolean"
},
"portal_reset_email": {
"type": "boolean"
},
"portal_reset_success_email": {
"type": "boolean"
},
"portal_session_conf": {
"type": "string"
},
"portal_smtp_admin_emails": {
"items": {
"type": "string"
},
"type": "array"
},
"portal_token_exp": {
"type": "integer"
}
},
"type": "object"
},
"created_at": {
"description": "Unix epoch when the resource was created.",
"nullable": true,
"type": "integer"
},
"id": {
"description": "A string representing a UUID (universally unique identifier).",
"nullable": true,
"type": "string"
},
"meta": {
"nullable": true,
"properties": {
"color": {
"type": "string"
},
"thumbnail": {
"type": "string"
}
},
"type": "object"
},
"name": {
"description": "A unique string representing a UTF-8 encoded name.",
"minLength": 1,
"type": "string"
},
"updated_at": {
"description": "Unix epoch when the resource was last updated.",
"nullable": true,
"type": "integer"
}
},
"required": [
"name"
],
"type": "object"
}
자주 묻는 질문(FAQ)
-
Workspace를 활성화해야 하나요? 아니요, Kong Gateway Enterprise에는
defaultWorkspace가 기본으로 포함되어 있어요. 추가 Workspace를 만들 수 있지만, 기본 Workspace는 항상 남아 있으며 삭제할 수 없어요. -
Workspace에 존재할 수 없는 엔티티가 있나요? 일부 엔티티는 Workspace 내에 존재할 수 없어요:
- CA 인증서는 모든 Workspace에 적용돼요. mTLS 핸드셰이크에서 클라이언트 인증서를 검증하는 데 사용돼요. SSL 핸드셰이크는 HTTP 요청을 받기 전에 이루어지기 때문에 이 시점에는 Workspace를 알 수 없어요.
- RBAC 엔티티 - Users, Roles, Admins, Groups -는 Workspace 외부에 존재해요. 하지만 특정 Workspace의 엔티티에 접근하려면 User, Admin, Group에 Workspace별 Role을 할당해야 해요.
- 다른 Workspace는 Workspace 내에 존재할 수 없어요.
-
Konnect에서 Workspace를 사용할 수 있나요? 아니요. 대신 Konnect는 API 생태계 내에서 엔티티를 관리할 수 있는 더 강력한 Control Plane과 Control Plane Group을 제공해요.
-
Workspace 이름이 다른 Workspace와 겹칠 수 있나요? 두 Workspace가 같은 이름을 가질 수는 없어요. 하지만 Workspace 이름은 대소문자를 구분해요. 예를 들어 “Payments”와 “payments”는 서로 같지 않으며, 서로 다른 두 Workspace로 허용돼요. 혼동을 피하려면 대소문자와 관계없이 Workspace에 고유한 이름을 지정하는 것을 추천해요.
-
Workspace를 지정하지 않고 엔티티를 만들면 어떻게 되나요? 대상 Workspace를 지정하지 않으면 엔티티가
defaultworkspace에 생성돼요. -
The following workspace(s) have names that conflict with admin API URL prefixes in this version of Kong오류는 어떻게 해결하나요?Kong Gateway 3.15.0.0부터 최상위 Admin API 라우트 세그먼트와 일치하는 Workspace 이름은 더 이상 허용되지 않아요.
kong workspace유틸리티를 사용하면 충돌하는 모든 Workspace를 식별하고 이름을 바꿀 수 있어요. 자세한 내용은 Workspace 이름 충돌 해결하기를 참고하세요.
관련 리소스
더 알아보기 (Learn more)
- 워크스페이스와 결합해 팀별 격리 환경과 세밀한 접근 권한을 구성하는 핵심 개념이에요 — RBAC
- 워크스페이스 엔티티의 정의와 스키마를 다루는 공식 문서예요 — Kong workspace documentation
- 워크스페이스 간 공유가 불가능한 대표 엔티티인 Gateway Service를 설명해요 — Gateway Services
- 워크스페이스 간 라우팅 충돌 감지와 관련된 Route 엔티티를 설명해요 — Routes
- CLI 명령어로 워크스페이스를 생성하고 관리하는 방법을 확인해요 —
kong workspace - 워크스페이스 이름 충돌을 피하려면 예약된 엔티티 이름 목록을 확인해요 — Reserved entity names