동적 앱 등록
동적 앱 등록을 사용하면 Teleport 관리자가 Teleport Application Service 인스턴스에서 읽는 정적 구성 파일을 업데이트하지 않고도 새 앱을 등록하거나 기존 앱을 업데이트/해제할 수 있습니다.
동적 앱 등록을 사용하면 Teleport 관리자가 Teleport Application Service 인스턴스에서 읽는 정적 구성 파일을 업데이트하지 않고도 새 앱을 등록하거나 기존 앱을 업데이트/해제할 수 있습니다.
Application Service 인스턴스는 주기적으로 Teleport Auth Service에 app 리소스를 쿼리하며, 각 리소스에는 Application Service가 애플리케이션을 프록시하는 데 필요한 정보가 포함됩니다.
동적 등록은 Application Service 인스턴스 풀을 관리하는 데 유용합니다. 내부적으로 Teleport Discovery Service는 동적 등록을 사용하여 Kubernetes 애플리케이션을 등록합니다.
필요한 권한#
In order to interact with dynamically registered applications, a user must have
a Teleport role with permissions to manage app resources.
In the following example, a role allows a user to perform all possible
operations against app resources:
allow:
rules:
- resources:
- app
verbs: [list, create, read, update, delete]
동적 등록 활성화#
To enable dynamic registration, include a resources section in your Application
Service configuration with a list of resource label selectors you'd like this
service to monitor for registering:
app_service:
enabled: true
resources:
- labels:
"*": "*"
You can use a wildcard selector to register all dynamic app resources in the cluster on the Application Service or provide a specific set of labels for a subset:
resources:
- labels:
"env": "prod"
- labels:
"env": "test"
앱 리소스 생성#
app 리소스를 생성하여 Teleport가 애플리케이션을 동적으로 프록시하도록 구성합니다. 다음 예시는 Teleport가 localhost:4321에서 example이라는 애플리케이션을 프록시하고 공개 주소 test.example.com에서 사용 가능하도록 구성합니다:
kind: app
version: v3
metadata:
name: example
description: "Example app"
labels:
env: test
spec:
uri: http://localhost:4321
public_addr: test.example.com
전체 앱 리소스 스펙 참조를 확인하세요.
동적 등록을 생성하는 사용자는 애플리케이션 레이블과 app 리소스에 접근하는 역할이 필요합니다. 이 예시 역할에서 사용자는 env: test로 레이블이 지정된 애플리케이션 서비스만 생성하고 유지 관리할 수 있습니다.
kind: role
metadata:
name: dynamicappregexample
spec:
allow:
app_labels:
env: test
rules:
- resources:
- app
verbs:
- list
- create
- read
- update
- delete
version: v5
애플리케이션 리소스를 생성하려면 다음을 실행합니다:
# 로컬 머신에서 tctl을 사용할 수 있도록 tsh로 클러스터에 로그인합니다.
# "tsh login"을 먼저 실행하지 않고 Auth Service 호스트에서 tctl을 실행할 수도 있습니다.
$ tsh login --proxy=teleport.example.com --user=myuser
$ tctl create app.yaml
# tctl을 원격으로 사용할 수 있도록 Teleport 클러스터에 로그인합니다.
$ tsh login --proxy=mytenant.teleport.sh --user=myuser
$ tctl create app.yaml
리소스가 생성되면, 적어도 하나의 Application Service 인스턴스가 레이블 셀렉터에 따라 이를 선택하는 한 사용 가능한 앱 목록(tsh apps ls 또는 UI에서)에 표시됩니다.
기존 애플리케이션 리소스를 업데이트하려면 다음을 실행합니다:
$ tctl create -f app.yaml
업데이트된 리소스의 레이블이 특정 앱 에이전트와 더 이상 일치하지 않으면, 해당 에이전트는 등록을 해제하고 프록시를 중지합니다.
애플리케이션 리소스를 삭제하려면 다음을 실행합니다:
$ tctl rm app/example
