GCP 태그 및 레이블을 Teleport 에이전트 레이블로 사용
Teleport v18.9이 가이드에서는 Google Cloud 태그를 기반으로 Google Compute Engine에서 실행 중인 Teleport 에이전트에 레이블을 할당하도록 Teleport 클러스터를 구성합니다. Google Compute Engine 인스턴스에서 실행할 때 Teleport는 GCP 태그(자체 리소스인 키-값 쌍)와 레이블(각 인스턴스에 특정한 키-값 쌍)을 자동으로 감지하고 SSH 노드, 애플리케이션, 데이터베이스, Kubernetes 클러스터의 Tele...
이 가이드에서는 Google Cloud 태그를 기반으로 Google Compute Engine에서 실행 중인 Teleport 에이전트에 레이블을 할당하도록 Teleport 클러스터를 구성합니다.
Google Compute Engine 인스턴스에서 실행할 때 Teleport는 GCP 태그(자체 리소스인 키-값 쌍)와 레이블(각 인스턴스에 특정한 키-값 쌍)을 자동으로 감지하고 SSH 노드, 애플리케이션, 데이터베이스, Kubernetes 클러스터의 Teleport 레이블로 가져옵니다. 이 방식으로 가져온 태그와 레이블 모두 gcp/ 접두사를 갖습니다. 추가로 태그에는 tag/ 중간 접사가, 레이블에는 label/ 중간 접사가 붙습니다. 예를 들어 레이블 foo=bar와 태그 baz=quux가 있는 인스턴스는 Teleport 레이블 gcp/label/foo=bar와 gcp/tag/baz=quux를 갖습니다.
Teleport 프로세스가 시작할 때 GCP API에서 모든 태그와 레이블을 가져와 레이블로 추가합니다. 프로세스는 매 시간 태그를 업데이트하므로 새로 생성되거나 삭제된 태그가 레이블에 반영됩니다.
GCP 레이블 TeleportHostname이 있는 경우 해당 값(소문자여야 함)이 노드의 호스트명을 재정의합니다. 이는 GCP 태그에는 적용되지 않습니다.
$ tsh ls
Node Name Address Labels
-------------------- -------------- -------------------------------------------------------------------------------------------
fakehost.example.com 127.0.0.1:3022 gcp/label/testing=yes,gcp/tag/environment=staging,gcp/TeleportHostname=fakehost.example.com
여러 리소스를 관리하는 서비스(예: Database Service)의 경우 각 리소스는 GCP에서 동일한 태그와 레이블을 받습니다.
사전 요구 사항#
-
실행 중인 Teleport 클러스터. Teleport를 시작하려면 무료 체험판에 가입하거나 데모 환경을 구성하세요.
-
tctlandtshclients.Installing `tctl` and `tsh` clients
-
Teleport 클러스터의 버전을 확인합니다.
tctlandtshclients는 Teleport 클러스터 버전보다 최대 한 개의 메이저 버전까지만 뒤처질 수 있습니다. Proxy Service의/v1/webapi/find로 GET 요청을 보내고 JSON 쿼리 도구를 사용하여 클러스터 버전을 확인합니다.teleport.example.com:443를 Teleport Proxy Service의 웹 주소로 바꿉니다:$ TELEPORT_DOMAIN=teleport.example.com:443 $ TELEPORT_VERSION="$(curl -s https://$TELEPORT_DOMAIN/v1/webapi/find | jq -r '.server_version')" -
사용 중인 플랫폼에 대한 지침에 따라
tctlandtshclients를 설치합니다:
-
Mac
`tctl` and `tsh` clients가 포함된, 서명된 Teleport macOS .pkg 설치 프로그램을 다운로드합니다:
```code
$ curl -O https://cdn.teleport.dev/teleport-${TELEPORT_VERSION?}.pkg
```
Finder에서 `pkg` 파일을 더블 클릭하여 설치를 시작합니다.
Homebrew를 사용하여 Teleport를 설치하는 것은 지원되지 않습니다. Homebrew의
Teleport 패키지는 Teleport에서 유지 관리하지 않으므로 신뢰성이나 보안을
보장할 수 없습니다.
Windows - Powershell
```code
$ curl.exe -O https://cdn.teleport.dev/teleport-v${TELEPORT_VERSION?}-windows-amd64-bin.zip
# Unzip the archive and move the `tctl` and `tsh` clients to your %PATH%
# NOTE: Do not place the `tctl` and `tsh` clients in the System32 directory, as this can cause issues when using WinSCP.
# Use %SystemRoot% (C:\Windows) or %USERPROFILE% (C:\Users\<username>) instead.
```
Linux
Linux 설치판의 모든 Teleport 바이너리에는 `tctl` and `tsh` clients가 포함되어 있습니다. RPM/DEB
패키지 및 i386/ARM/ARM64용 다운로드를 포함한 더 많은 옵션은
[설치 페이지](../installation/installation.mdx)를 참조하세요.
```code
$ curl -O https://cdn.teleport.dev/teleport-v${TELEPORT_VERSION?}-linux-amd64-bin.tar.gz
$ tar -xzf teleport-v${TELEPORT_VERSION?}-linux-amd64-bin.tar.gz
$ cd teleport
$ sudo ./install
# Teleport binaries have been copied to /usr/local/bin
```
- GCP Compute 인스턴스에서 실행 중인 Teleport 에이전트 하나. Teleport 에이전트 설정 방법은 가이드를 참조하십시오.
Teleport 노드가 있는 인스턴스에서 서비스 계정 구성#
태그와 레이블을 가져오는 데 필요한 IAM 권한을 Teleport에 부여할 서비스 계정을 생성하십시오. 다음을 복사하여
teleport-labels-role.yaml 파일에 붙여넣으십시오:
# teleport-labels-role.yaml
title: "teleport-labels"
description: "A role to enable Teleport to import tags and labels"
stage: "ALPHA"
includedPermissions:
- compute.instances.get
- compute.instances.listEffectiveTags
그런 다음 다음 명령어를 실행하여 역할을 생성하십시오:
$ gcloud iam roles create teleport_labels \
--project=project_id \
--file=teleport-labels-role.yaml
다음 명령어를 실행하여 서비스 계정을 생성하십시오:
$ gcloud iam service-accounts create teleport-labels \
--description="A service account to enable Teleport to import tags and labels" \
--display-name="teleport-labels"
다음 명령어를 실행하여 새 서비스 계정에 새 역할을 추가하십시오:
$ gcloud projects add-iam-policy-binding project_id \
--member="serviceAccount:teleport-labels@project_id.iam.gserviceaccount.com" \
--role="projects/project_id/roles/teleport_labels"
레이블만 가져오거나 태그만 가져오려면 생성한 서비스 계정의 권한에서 각각 compute.instances.listEffectiveTags 또는
compute.instances.get을 제외할 수 있습니다.