InfoGrab Docs

Kubernetes 애플리케이션 자동 검색 시작하기

요약

Teleport는 Kubernetes 클러스터에서 실행 중인 애플리케이션을 자동으로 감지하고 Teleport 클러스터에 등록할 수 있습니다. 이 가이드에서는 Kubernetes 애플리케이션 자동 검색을 활성화하는 방법을 보여줍니다.

Teleport는 Kubernetes 클러스터에서 실행 중인 애플리케이션을 자동으로 감지하고 Teleport 클러스터에 등록할 수 있습니다. 이 설정을 통해 Kubernetes 호스팅 인프라를 사용하는 사용자는 초기 설정 단계를 넘어 수동 개입 없이 새로 배포하는 모든 애플리케이션에 대한 보안 접근을 설정할 수 있습니다.

이 가이드에서는 Kubernetes 애플리케이션 자동 검색을 활성화하는 방법을 보여줍니다.

작동 방식#

Teleport Discovery Service는 애플리케이션을 감지하려는 Kubernetes 클러스터의 API 서버를 조회하여 클러스터 내에서 감지된 Kubernetes 서비스에 맞는 동적 app 리소스를 유지 관리합니다. Teleport Application Service는 Teleport Auth Service에 app 리소스를 가져오는 쿼리를 보내고 동적으로 생성된 설정을 기반으로 애플리케이션을 프록시합니다.

사전 조건#

  • A running Teleport cluster. If you want to get started with Teleport, sign up for a free trial or set up a demo environment.

  • The tctl and tsh clients.

    Installing `tctl` and `tsh` clients
    1. Determine the version of your Teleport cluster. The tctl and tsh clients must be at most one major version behind your Teleport cluster version. Send a GET request to the Proxy Service at /v1/webapi/find and use a JSON query tool to obtain your cluster version. Replace with the web address of your Teleport Proxy Service:

      $ TELEPORT_DOMAIN=
      $ TELEPORT_VERSION="$(curl -s https://$TELEPORT_DOMAIN/v1/webapi/find | jq -r '.server_version')"
      
    2. Follow the instructions for your platform to install tctl and tsh clients:

  • Kubernetes 클러스터 버전 >= v[kubernetes.major_version].[kubernetes.minor_version].0

  • Helm >= [helm.version]

Verify that Helm and Kubernetes are installed and up to date.

$ helm version
# version.BuildInfo{Version:"v(=helm.version=)"}

$ kubectl version
# Client Version: version.Info{Major:"(=kubernetes.major_version=)", Minor:"(=kubernetes.minor_version=)+"}
# Server Version: version.Info{Major:"(=kubernetes.major_version=)", Minor:"(=kubernetes.minor_version=)+"}

To check that you can connect to your Teleport cluster, sign in with tsh login, then verify that you can run tctl commands using your current credentials.

For example, run the following command, assigning to the domain name of the Teleport Proxy Service in your cluster and to your Teleport username:

$ tsh login --proxy= --user=
$ tctl status
# Cluster  (=teleport.url=)
# Version  (=teleport.version=)
# CA pin   (=presets.ca_pin=)

If you can connect to the cluster and run the tctl status command, you can use your current credentials to run subsequent tctl commands from your workstation. If you host your own Teleport cluster, you can also run tctl commands on the computer that hosts the Teleport Auth Service for full permissions.

1/2 단계. 조인 토큰 생성#

Teleport Kubernetes Service, Application Service 및 Discovery Service를 실행할 새 Teleport 에이전트에 대한 조인 토큰을 생성합니다:

$ tctl tokens add --type=kube,app,discovery

기본적으로 discovery 역할을 활성화하면 Kubernetes 서비스 자동 검색과 해당 서비스에서 Teleport 애플리케이션 등록이 자동으로 시작됩니다. 차트에서 app 역할을 활성화하면 검색된 Kubernetes 서비스에서 생성된 모든 새 Teleport 애플리케이션의 프록시 프로세스가 시작됩니다.

2/2 단계. 에이전트 배포#

Kubernetes 클러스터에 새 Teleport 에이전트를 설치하려면 teleport-kube-agent Helm 차트를 사용할 수 있습니다. 이미 Teleport 에이전트가 설치되어 있는 경우 아래와 같이 역할에 kube, app, discovery를 추가하여 Kubernetes 애플리케이션 자동 검색을 활성화하도록 업그레이드할 수 있습니다.

설정된 서비스를 실행하는 새 Teleport 에이전트를 teleport-kube-agent Helm 차트를 설치하여 배포합니다. 를 Teleport Proxy Service의 호스트 및 포트로, 을 이전에 생성한 조인 토큰으로 지정합니다:

$ helm install teleport-agent teleport/teleport-kube-agent \
  --set roles=kube\,app\,discovery \
  --set kubeClusterName=main-cluster \
  --set proxyAddr= \
  --set authToken= \
  --create-namespace \
  --namespace=teleport

기존 teleport-kube-agent 설치가 있고 Kubernetes 앱 자동 검색을 활성화하려면 기존 설치 역할을 업데이트하여 kube, app, discovery 역할을 포함해야 합니다:

$ helm upgrade teleport-agent teleport/teleport-kube-agent \
  --reuse-values \
  --set roles=kube\,app\,discovery \
  --set authToken= \
  --namespace=teleport

문제 해결#

먼저 Teleport Discovery, Application 및 Kubernetes Service에 대한 모든 예상 에이전트가 실행 중인지 확인합니다. 이 에이전트를 위해 생성한 토큰에 필요한 역할이 있어야 합니다.

에이전트가 실행 중이지만 Teleport에 예상 앱이 표시되지 않는 경우 두 가지 주요 원인이 있을 수 있습니다:

  • Teleport Discovery Service가 관련 Kubernetes 서비스를 찾을 수 없습니다.
  • Teleport Application Service가 검색된 애플리케이션을 프록시할 수 없습니다.

Discovery Service가 실행 중인 Kubernetes 서비스 계정에 클러스터의 서비스를 나열할 충분한 권한이 있는지 확인합니다. 또한 레이블 및 네임스페이스 설정이 올바른지 확인합니다.

Application Service의 경우 resources 필드의 레이블이 올바르게 정의되어 있는지, 특히 teleport.dev/kubernetes-cluster 레이블이 Kubernetes 클러스터에서 실행 중인 Discovery Service의 discovery_group 필드와 일치하는지 확인합니다.

다음 단계#

Discovery Service의 범위를 설정할 수 있습니다. 자세한 내용은 teleport-kube-agent helm 차트 문서를 참조하세요.

Kubernetes 애플리케이션 자동 검색 시작하기

원문 보기
요약

Teleport는 Kubernetes 클러스터에서 실행 중인 애플리케이션을 자동으로 감지하고 Teleport 클러스터에 등록할 수 있습니다. 이 가이드에서는 Kubernetes 애플리케이션 자동 검색을 활성화하는 방법을 보여줍니다.

Teleport는 Kubernetes 클러스터에서 실행 중인 애플리케이션을 자동으로 감지하고 Teleport 클러스터에 등록할 수 있습니다. 이 설정을 통해 Kubernetes 호스팅 인프라를 사용하는 사용자는 초기 설정 단계를 넘어 수동 개입 없이 새로 배포하는 모든 애플리케이션에 대한 보안 접근을 설정할 수 있습니다.

이 가이드에서는 Kubernetes 애플리케이션 자동 검색을 활성화하는 방법을 보여줍니다.

작동 방식#

Teleport Discovery Service는 애플리케이션을 감지하려는 Kubernetes 클러스터의 API 서버를 조회하여 클러스터 내에서 감지된 Kubernetes 서비스에 맞는 동적 app 리소스를 유지 관리합니다. Teleport Application Service는 Teleport Auth Service에 app 리소스를 가져오는 쿼리를 보내고 동적으로 생성된 설정을 기반으로 애플리케이션을 프록시합니다.

사전 조건#

  • A running Teleport cluster. If you want to get started with Teleport, sign up for a free trial or set up a demo environment.

  • The tctl and tsh clients.

    Installing `tctl` and `tsh` clients
    1. Determine the version of your Teleport cluster. The tctl and tsh clients must be at most one major version behind your Teleport cluster version. Send a GET request to the Proxy Service at /v1/webapi/find and use a JSON query tool to obtain your cluster version. Replace with the web address of your Teleport Proxy Service:

      $ TELEPORT_DOMAIN=
      $ TELEPORT_VERSION="$(curl -s https://$TELEPORT_DOMAIN/v1/webapi/find | jq -r '.server_version')"
      
    2. Follow the instructions for your platform to install tctl and tsh clients:

  • Kubernetes 클러스터 버전 >= v[kubernetes.major_version].[kubernetes.minor_version].0

  • Helm >= [helm.version]

Verify that Helm and Kubernetes are installed and up to date.

$ helm version
# version.BuildInfo{Version:"v(=helm.version=)"}

$ kubectl version
# Client Version: version.Info{Major:"(=kubernetes.major_version=)", Minor:"(=kubernetes.minor_version=)+"}
# Server Version: version.Info{Major:"(=kubernetes.major_version=)", Minor:"(=kubernetes.minor_version=)+"}

To check that you can connect to your Teleport cluster, sign in with tsh login, then verify that you can run tctl commands using your current credentials.

For example, run the following command, assigning to the domain name of the Teleport Proxy Service in your cluster and to your Teleport username:

$ tsh login --proxy= --user=
$ tctl status
# Cluster  (=teleport.url=)
# Version  (=teleport.version=)
# CA pin   (=presets.ca_pin=)

If you can connect to the cluster and run the tctl status command, you can use your current credentials to run subsequent tctl commands from your workstation. If you host your own Teleport cluster, you can also run tctl commands on the computer that hosts the Teleport Auth Service for full permissions.

1/2 단계. 조인 토큰 생성#

Teleport Kubernetes Service, Application Service 및 Discovery Service를 실행할 새 Teleport 에이전트에 대한 조인 토큰을 생성합니다:

$ tctl tokens add --type=kube,app,discovery

기본적으로 discovery 역할을 활성화하면 Kubernetes 서비스 자동 검색과 해당 서비스에서 Teleport 애플리케이션 등록이 자동으로 시작됩니다. 차트에서 app 역할을 활성화하면 검색된 Kubernetes 서비스에서 생성된 모든 새 Teleport 애플리케이션의 프록시 프로세스가 시작됩니다.

2/2 단계. 에이전트 배포#

Kubernetes 클러스터에 새 Teleport 에이전트를 설치하려면 teleport-kube-agent Helm 차트를 사용할 수 있습니다. 이미 Teleport 에이전트가 설치되어 있는 경우 아래와 같이 역할에 kube, app, discovery를 추가하여 Kubernetes 애플리케이션 자동 검색을 활성화하도록 업그레이드할 수 있습니다.

설정된 서비스를 실행하는 새 Teleport 에이전트를 teleport-kube-agent Helm 차트를 설치하여 배포합니다. 를 Teleport Proxy Service의 호스트 및 포트로, 을 이전에 생성한 조인 토큰으로 지정합니다:

$ helm install teleport-agent teleport/teleport-kube-agent \
  --set roles=kube\,app\,discovery \
  --set kubeClusterName=main-cluster \
  --set proxyAddr= \
  --set authToken= \
  --create-namespace \
  --namespace=teleport

기존 teleport-kube-agent 설치가 있고 Kubernetes 앱 자동 검색을 활성화하려면 기존 설치 역할을 업데이트하여 kube, app, discovery 역할을 포함해야 합니다:

$ helm upgrade teleport-agent teleport/teleport-kube-agent \
  --reuse-values \
  --set roles=kube\,app\,discovery \
  --set authToken= \
  --namespace=teleport

문제 해결#

먼저 Teleport Discovery, Application 및 Kubernetes Service에 대한 모든 예상 에이전트가 실행 중인지 확인합니다. 이 에이전트를 위해 생성한 토큰에 필요한 역할이 있어야 합니다.

에이전트가 실행 중이지만 Teleport에 예상 앱이 표시되지 않는 경우 두 가지 주요 원인이 있을 수 있습니다:

  • Teleport Discovery Service가 관련 Kubernetes 서비스를 찾을 수 없습니다.
  • Teleport Application Service가 검색된 애플리케이션을 프록시할 수 없습니다.

Discovery Service가 실행 중인 Kubernetes 서비스 계정에 클러스터의 서비스를 나열할 충분한 권한이 있는지 확인합니다. 또한 레이블 및 네임스페이스 설정이 올바른지 확인합니다.

Application Service의 경우 resources 필드의 레이블이 올바르게 정의되어 있는지, 특히 teleport.dev/kubernetes-cluster 레이블이 Kubernetes 클러스터에서 실행 중인 Discovery Service의 discovery_group 필드와 일치하는지 확인합니다.

다음 단계#

Discovery Service의 범위를 설정할 수 있습니다. 자세한 내용은 teleport-kube-agent helm 차트 문서를 참조하세요.