GCP로 서비스 등록하기
Teleport v18.9이 가이드에서는 GCP 조인 방법을 사용하여 GCP VM에서 실행 중인 Teleport 프로세스가 비밀을 공유하지 않고 Teleport 클러스터에 참여하도록 구성하는 방법을 설명합니다. GCP 조인 방법은 GCP VM에서 실행 중인 모든 Teleport 프로세스에서 사용할 수 있습니다.
이 가이드에서는 GCP 조인 방법을 사용하여 GCP VM에서 실행 중인 Teleport 프로세스가 비밀을 공유하지 않고 Teleport 클러스터에 참여하도록 구성하는 방법을 설명합니다.
작동 방식#
GCP 조인 방법은 GCP VM에서 실행 중인 모든 Teleport 프로세스에서 사용할 수 있습니다. VM에는 서비스 계정 이 할당되어 있어야 합니다(기본 서비스 계정으로 충분합니다). 클러스터에 참여하는 Teleport 프로세스에는 IAM 역할이 필요하지 않습니다.
내부적으로, 서비스는 GCP 프로젝트에서 실행 중임을 증명하기 위해 GCP 조인 토큰에 구성된 허용 규칙과 일치하는 서명된 ID 토큰을 전송합니다.
사전 요구 사항#
-
실행 중인 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
```
- Teleport 서비스를 호스팅할 GCP VM으로, 서비스 계정이 할당되어 있고 Teleport 바이너리가 설치되어 있어야 합니다.
Teleport cluster에 연결할 수 있는지 확인하려면 tsh login으로 로그인한 다음,
현재 자격 증명으로 tctl 명령을 실행할 수 있는지 확인합니다.
예를 들어, teleport.example.com에 cluster 내 Teleport Proxy Service의
도메인 이름을, email@example.com에 Teleport 사용자 이름을 지정하여
다음 명령을 실행합니다:
$ tsh login --proxy=teleport.example.com --user=email@example.com
$ tctl status
# Cluster (=teleport.url=)
# Version (=teleport.version=)
# CA pin (=presets.ca_pin=)
cluster에 연결하여 tctl status 명령을 실행할 수 있다면, 현재 자격 증명을 사용하여
워크스테이션에서 이후의 tctl 명령을 실행할 수 있습니다.
자체 Teleport cluster를 호스팅하는 경우, 전체 권한을 얻기 위해 Teleport Auth Service를
호스팅하는 컴퓨터에서 tctl 명령을 실행할 수도 있습니다.
1/4단계. GCP 조인 토큰 생성#
GCP 프로젝트의 서비스가 Teleport 클러스터에 참여할 수 있도록 하는 특수 동적 토큰으로 Teleport Auth Service를 구성합니다.
GCP 인스턴스가 실행될 GCP 프로젝트 ID, 서비스 계정, 위치를 지정하는 gcp.allow 규칙을
포함한 다음 token.yaml 파일을 생성합니다:
# token.yaml
kind: token
version: v2
metadata:
# the token name is not a secret because instances must prove that they are
# running in your GCP project to use this token
name: gcp-token
spec:
# use the minimal set of roles required (e.g. Node, Proxy, App, Kube, DB, WindowsDesktop)
roles: [Node]
# set the join method allowed for this token
join_method: gcp
gcp:
allow:
# The GCP project ID(s) that VMs can join from.
- project_ids: ["example-project-id"]
# (Optional) The locations that VMs can join from. Note: both regions and
# zones are accepted.
locations: ["us-west1", "us-west2-a"]
# (Optional) The email addresses of service accounts that VMs can join
# with.
service_accounts: ["example@example.com"]
다음 명령을 실행하여 토큰을 생성합니다:
$ tctl create token.yaml
2/4단계. Teleport 설치#
GCP Linux VM에 Teleport를 설치합니다.
Linux 서버에 Teleport Agent를 설치하려면:
권장 설치 방법은 클러스터 설치 스크립트입니다. 이 스크립트는 클러스터에 맞는 올바른 버전, 에디션, 설치 모드를 선택합니다.
-
teleport.example.com:443에 Teleport 클러스터의 호스트명과 포트를 할당하되, 스킴(https://)은 포함하지 마십시오. -
클러스터의 설치 스크립트를 실행하십시오:
$ curl "https://teleport.example.com:443/scripts/install.sh" | sudo bash
3/4단계. 서비스 구성#
GCP 조인 방법은 SSH(Node), Proxy, Kubernetes, 애플리케이션, 데이터베이스 또는
Windows Desktop Services를 실행하는 Teleport 프로세스에 사용할 수 있습니다. Teleport
프로세스는 GCP VM에서 직접 실행되어야 합니다.
사용자 지정 teleport.yaml 파일로 Teleport 프로세스를 구성합니다. 1단계에서 생성한
토큰과 일치하는 token_name 및 method: gcp를 포함한 join_params 섹션을 다음
예시 구성과 같이 사용합니다:
# /etc/teleport.yaml
version: v3
teleport:
join_params:
token_name: gcp-token
method: gcp
proxy_server: https://teleport.example.com:443
ssh_service:
enabled: true
auth_service:
enabled: false
proxy_service:
enabled: false
4/4단계. Teleport 프로세스 실행#
systemd 서비스를 생성하여 호스트가 부팅될 때 your Teleport instance이 자동으로 시작되도록 구성합니다. 지침은 your Teleport instance을 어떻게 설치했는지에 따라 다릅니다.
Package Manager
your Teleport instance을 실행할 호스트에서 Teleport를 활성화하고 시작합니다:
$ sudo systemctl enable teleport
$ sudo systemctl start teleport
TAR Archive
your Teleport instance을 실행할 호스트에서 Teleport용 systemd 서비스 구성을 생성하고, Teleport 서비스를 활성화한 후 Teleport를 시작합니다:
$ sudo teleport install systemd -o /etc/systemd/system/teleport.service
$ sudo systemctl enable teleport
$ sudo systemctl start teleport
systemctl status teleport로 your Teleport instance의 상태를 확인하고 journalctl -fu teleport로
로그를 볼 수 있습니다.
Teleport를 시작한 후, 서비스가 클러스터에 연결하여 참여할 수 있는지 확인합니다.