InfoGrab DocsInfoGrab Docs

Kubernetes 클러스터 자동 검색

요약

Kubernetes 클러스터 자동 검색을 사용하면 클라우드 공급자에서 호스팅되는 Kubernetes 클러스터를 자동으로 검색하고 등록할 수 있습니다. 새로운 Kubernetes 클러스터를 검색하는 동안 Teleport는 클러스터에 어떤 구성 요소도 설치하지 않습니다.

Kubernetes 클러스터 자동 검색을 사용하면 클라우드 공급자에서 호스팅되는 Kubernetes 클러스터를 자동으로 검색하고 등록할 수 있습니다.

새로운 Kubernetes 클러스터를 검색하는 동안 Teleport는 클러스터에 어떤 구성 요소도 설치하지 않습니다. 대신, 클러스터의 API에 대한 직접 접근과 최소한의 접근 권한이 필요합니다.

이 페이지에서는 Kubernetes 클러스터 자동 검색의 아키텍처를 설명합니다.

지원되는 클라우드#

  • AWS: AWS EKS 클러스터에 대한 자동 검색.
  • Azure: Azure AKS 클러스터에 대한 자동 검색.
  • Google Cloud: Google Kubernetes Engine 클러스터에 대한 자동 검색.

Kubernetes 클러스터 자동 검색 작동 방식#

Kubernetes 클러스터 자동 검색은 두 단계로 이루어집니다:

클라우드 API 폴링#

Teleport Discovery Service는 설정된 클라우드 공급자를 스캔하고 Kubernetes 클러스터가 필터링 레이블 집합과 일치하는지 식별하는 역할을 합니다. 프로세스가 새로운 Kubernetes 클러스터를 식별하면 Teleport 내에 동적 리소스를 생성합니다. 이 리소스에는 클라우드 공급자에서 가져온 다음과 같은 정보가 포함됩니다:

  • 이름: 클러스터 이름
  • 레이블
    • 클러스터 태그.
    • 클러스터 위치.
    • 클러스터가 속한 클라우드 계정 식별 — AWS 계정 ID / Azure 구독 ID.
Tip

Teleport 레지스트리에 클러스터를 다른 이름으로 가져올 수 있습니다. 이를 위해서는 클라우드 공급자의 리소스(EKS, AKS, GKE)에 다음 태그를 추가해야 합니다:

  • key: TeleportKubernetesName
  • value: 원하는 이름

Discovery Service는 클러스터에 해당 태그가 포함되어 있는지 확인하고 해당 값을 Teleport의 리소스 이름으로 사용합니다.

서로 다른 리전/클라우드 공급자에 동일한 이름을 가진 클러스터가 있어 Teleport에서 충돌이 발생하는 경우 이 기능을 사용해야 합니다.

새로운 Kubernetes 클러스터를 감지하는 것 외에도, Discovery Service는 삭제되었거나 태그가 더 이상 필터링 레이블을 충족하지 않는 Kubernetes 클러스터를 Teleport 레지스트리에서 제거합니다.

Warning

Discovery Service는 검색된 리소스를 서로 다른 집합으로 그룹화할 수 있게 하는 구성 파라미터 discovery_service.discovery_group을 제공합니다. 이 파라미터는 서로 다른 클라우드 리소스 집합을 감시하는 Discovery Agent들이 서로 충돌하여 다른 서비스가 생성한 리소스를 삭제하는 것을 방지하는 데 사용됩니다.

여러 개의 Discovery Service를 실행할 때, 동일한 클라우드 리소스를 감시하는 경우에는 각 서비스가 동일한 discovery_group 값으로 구성되어 있는지 확인해야 하며, 서로 다른 클라우드 리소스를 감시하는 경우에는 서로 다른 값으로 구성해야 합니다.

동일한 Teleport 클러스터에서 구성을 혼합하여 실행할 수 있습니다. 즉 일부 Discovery Service는 동일한 클라우드 리소스를 감시하도록 구성하고 다른 서비스는 서로 다른 리소스를 감시하도록 구성할 수 있습니다. 예를 들어, 서로 다른 두 개의 클라우드 계정에서 데이터를 분석하는 4개 에이전트 고가용성 구성은 다음과 같은 구성으로 실행됩니다.

  • Production 계정에서 데이터를 폴링하는 discovery_group: "prod"로 구성된 Discovery Service 2개.
  • Staging 계정에서 데이터를 폴링하는 discovery_group: "staging"로 구성된 Discovery Service 2개.

다음 스니펫은 Discovery Service의 다양한 설정 옵션과 기본값을 설명합니다.

# This section configures the Discovery Service
discovery_service:
    enabled: true
    discovery_group: "prod"
    aws:
       # AWS resource types. Valid options are:
       # eks - discovers and registers AWS EKS clusters
       # ec2 - discovers and registers AWS EC2 Machines
     - types: ["eks"]
       # AWS regions to search for resources from. Valid options are:
       # '*' - discovers resources in all enabled regions (default).
       # Any valid AWS region name, e.g. "us-east-1".
       regions: ["us-east-1", "us-west-1"]
       # AWS resource tags to match when registering resources
       # Optional section: Defaults to "*":"*"
       tags:
         "env": "prod"
       # AWS role to assume when discovering resources in the AWS Account.
       # This value is an optional AWS role ARN to assume when polling EKS clusters
       assume_role_arn: arn:aws:iam::123456789012:role/iam-discovery-role
       # External ID is an optional value that should be set when accessing
       # your AWS account from a third-party service (delegated access).
       external_id: "example-external-id"
       # Optional role for which the Discovery Service should create the EKS access entry.
       # If not set, the Discovery Service will attempt to create the access
       # entry using its own identity.
       # If used, the role must match the role configured for a Teleport Kubernetes Service.
       setup_access_for_arn: arn:aws:iam::123456789012:role/kube-service-role
    # Matchers for discovering Azure-hosted resources.
    azure:
      # Azure resource types. Valid options are:
      # 'aks' - discovers and registers Azure AKS Kubernetes Clusters.
    - types: ["aks"]
      # Azure regions to search for resources from. Valid options are:
      # '*' - discovers resources in all regions (default).
      # Any valid Azure region name. List all valid regions using the Azure "az" cli: `az account list-locations -o table`
      regions: ["*"]
      # Azure subscription IDs to search resources from. Valid options are:
      # '*' - discovers resources in all subscriptions (default).
      # Any subscription_id: `az account subscription list -o table`
      subscriptions: ["*"]
      # Azure resource groups to search resources from. Valid options are:
      # '*' - discovers resources in all resource groups within configured subscription(s) (default).
      # Any resource_groups: `az group list -o table`
      resource_groups: ["*"]
      # Azure resource tag filters used to match resources.
      # Optional section: Defaults to "*":"*"
      tags:
        "env": "prod"
    # Matchers for discovering GCP-hosted resources.
    gcp:
      # GCP resource types. Valid options are:
      # 'gke' - discovers and registers GCP GKE Kubernetes Clusters.
    - types: ["gke"]
      # GCP location to search for resources from. Valid options are:
      # '*' - discovers resources in all locations (default).
      # Any valid GCP region or zone name.
      locations: ["*"]
      # GCP project ID
      project_ids: ["myproject"]
      # GCP resource tag filters used to match resources.
      # Optional section: Defaults to "*":"*"
      tags:
        "*" : "*"

Kubernetes 클러스터로 요청 전달#

Teleport Kubernetes Service는 Discovery Service가 생성하거나 업데이트한 동적 리소스를 모니터링하고 해당 리소스가 나타내는 Kubernetes 클러스터로 요청을 전달하는 역할을 합니다. 올바르게 작동하려면 대상 Kubernetes 클러스터에 대한 직접 접근과 요청을 전달할 수 있는 권한이 필요합니다.

Kubernetes Service에서 동적 리소스 모니터링을 활성화하려면 다음 스니펫과 같이 kubernetes_service.resources 섹션을 설정해야 합니다:

## This section configures the Kubernetes Service
kubernetes_service:
    enabled: true
    # Matchers for dynamic Kubernetes cluster resources created with the "tctl create" command or by Kubernetes auto-discovery.
    resources:
    - labels:
        "*": "*" # can be configured to limit the clusters to watched by this service.
      aws:
       # AWS role to assume when accessing EKS clusters in the AWS Account.
       # This value is an optional AWS role ARN to assume when forwarding requests
       # to EKS clusters.
       assume_role_arn: arn:aws:iam::123456789012:role/iam-discovery-role
       # External ID is an optional value that should be set when accessing
	     # your AWS account from a third-party service (delegated access).
       external_id: "example-external-id"

kubernetes_service.resources 매개변수를 설정하면 Teleport Kubernetes Service는 Teleport Discovery Service가 검색한 EKS 클러스터를 모니터링하도록 설정됩니다. 모니터링 프로세스는 레이블 매칭 메커니즘을 사용하여 EKS 클러스터를 식별하고 관리합니다.

  1. 검색 및 레이블 매칭: Discovery Service는 AWS 환경 내에서 사용 가능한 EKS 클러스터를 식별합니다. Teleport Kubernetes Service는 이 클러스터의 레이블을 선택기 배열kubernetes_service.resources[].labels 설정에 지정된 레이블과 비교합니다.
  2. 역할 선택: EKS 클러스터의 레이블과 일치하는 배열의 첫 번째 선택기가 Kubernetes Service가 위임할 역할을 결정합니다. 이 역할은 Teleport Kubernetes Service가 AWS API에서 필요한 클러스터 세부 정보를 가져오기 위해 필수적입니다. 일치하는 항목이 없으면 Kubernetes Service는 자체 ID를 기본으로 사용합니다.
  3. AWS 및 Kubernetes API와의 상호작용: 일치 항목이 발견되고 역할이 위임되면 Teleport Kubernetes Service는 이 역할을 사용하여 AWS API에 접근합니다. 설정 및 상태와 같은 EKS 클러스터에 대한 정보를 가져옵니다. 이후 Teleport Kubernetes Service는 클러스터와의 상호작용을 가능하게 하는 Kubernetes API로 요청을 전달합니다.

Discovery Service와 Kubernetes Service 모두 동일한 Teleport 프로세스 또는 별도의 프로세스에서 설정할 수 있습니다.

Kubernetes 클러스터 자동 검색

Teleport v18.9
원문 보기
요약

Kubernetes 클러스터 자동 검색을 사용하면 클라우드 공급자에서 호스팅되는 Kubernetes 클러스터를 자동으로 검색하고 등록할 수 있습니다. 새로운 Kubernetes 클러스터를 검색하는 동안 Teleport는 클러스터에 어떤 구성 요소도 설치하지 않습니다.

Kubernetes 클러스터 자동 검색을 사용하면 클라우드 공급자에서 호스팅되는 Kubernetes 클러스터를 자동으로 검색하고 등록할 수 있습니다.

새로운 Kubernetes 클러스터를 검색하는 동안 Teleport는 클러스터에 어떤 구성 요소도 설치하지 않습니다. 대신, 클러스터의 API에 대한 직접 접근과 최소한의 접근 권한이 필요합니다.

이 페이지에서는 Kubernetes 클러스터 자동 검색의 아키텍처를 설명합니다.

지원되는 클라우드#

  • AWS: AWS EKS 클러스터에 대한 자동 검색.
  • Azure: Azure AKS 클러스터에 대한 자동 검색.
  • Google Cloud: Google Kubernetes Engine 클러스터에 대한 자동 검색.

Kubernetes 클러스터 자동 검색 작동 방식#

Kubernetes 클러스터 자동 검색은 두 단계로 이루어집니다:

클라우드 API 폴링#

Teleport Discovery Service는 설정된 클라우드 공급자를 스캔하고 Kubernetes 클러스터가 필터링 레이블 집합과 일치하는지 식별하는 역할을 합니다. 프로세스가 새로운 Kubernetes 클러스터를 식별하면 Teleport 내에 동적 리소스를 생성합니다. 이 리소스에는 클라우드 공급자에서 가져온 다음과 같은 정보가 포함됩니다:

  • 이름: 클러스터 이름
  • 레이블
    • 클러스터 태그.
    • 클러스터 위치.
    • 클러스터가 속한 클라우드 계정 식별 — AWS 계정 ID / Azure 구독 ID.
Tip

Teleport 레지스트리에 클러스터를 다른 이름으로 가져올 수 있습니다. 이를 위해서는 클라우드 공급자의 리소스(EKS, AKS, GKE)에 다음 태그를 추가해야 합니다:

  • key: TeleportKubernetesName
  • value: 원하는 이름

Discovery Service는 클러스터에 해당 태그가 포함되어 있는지 확인하고 해당 값을 Teleport의 리소스 이름으로 사용합니다.

서로 다른 리전/클라우드 공급자에 동일한 이름을 가진 클러스터가 있어 Teleport에서 충돌이 발생하는 경우 이 기능을 사용해야 합니다.

새로운 Kubernetes 클러스터를 감지하는 것 외에도, Discovery Service는 삭제되었거나 태그가 더 이상 필터링 레이블을 충족하지 않는 Kubernetes 클러스터를 Teleport 레지스트리에서 제거합니다.

Warning

Discovery Service는 검색된 리소스를 서로 다른 집합으로 그룹화할 수 있게 하는 구성 파라미터 discovery_service.discovery_group을 제공합니다. 이 파라미터는 서로 다른 클라우드 리소스 집합을 감시하는 Discovery Agent들이 서로 충돌하여 다른 서비스가 생성한 리소스를 삭제하는 것을 방지하는 데 사용됩니다.

여러 개의 Discovery Service를 실행할 때, 동일한 클라우드 리소스를 감시하는 경우에는 각 서비스가 동일한 discovery_group 값으로 구성되어 있는지 확인해야 하며, 서로 다른 클라우드 리소스를 감시하는 경우에는 서로 다른 값으로 구성해야 합니다.

동일한 Teleport 클러스터에서 구성을 혼합하여 실행할 수 있습니다. 즉 일부 Discovery Service는 동일한 클라우드 리소스를 감시하도록 구성하고 다른 서비스는 서로 다른 리소스를 감시하도록 구성할 수 있습니다. 예를 들어, 서로 다른 두 개의 클라우드 계정에서 데이터를 분석하는 4개 에이전트 고가용성 구성은 다음과 같은 구성으로 실행됩니다.

  • Production 계정에서 데이터를 폴링하는 discovery_group: "prod"로 구성된 Discovery Service 2개.
  • Staging 계정에서 데이터를 폴링하는 discovery_group: "staging"로 구성된 Discovery Service 2개.

다음 스니펫은 Discovery Service의 다양한 설정 옵션과 기본값을 설명합니다.

# This section configures the Discovery Service
discovery_service:
    enabled: true
    discovery_group: "prod"
    aws:
       # AWS resource types. Valid options are:
       # eks - discovers and registers AWS EKS clusters
       # ec2 - discovers and registers AWS EC2 Machines
     - types: ["eks"]
       # AWS regions to search for resources from. Valid options are:
       # '*' - discovers resources in all enabled regions (default).
       # Any valid AWS region name, e.g. "us-east-1".
       regions: ["us-east-1", "us-west-1"]
       # AWS resource tags to match when registering resources
       # Optional section: Defaults to "*":"*"
       tags:
         "env": "prod"
       # AWS role to assume when discovering resources in the AWS Account.
       # This value is an optional AWS role ARN to assume when polling EKS clusters
       assume_role_arn: arn:aws:iam::123456789012:role/iam-discovery-role
       # External ID is an optional value that should be set when accessing
       # your AWS account from a third-party service (delegated access).
       external_id: "example-external-id"
       # Optional role for which the Discovery Service should create the EKS access entry.
       # If not set, the Discovery Service will attempt to create the access
       # entry using its own identity.
       # If used, the role must match the role configured for a Teleport Kubernetes Service.
       setup_access_for_arn: arn:aws:iam::123456789012:role/kube-service-role
    # Matchers for discovering Azure-hosted resources.
    azure:
      # Azure resource types. Valid options are:
      # 'aks' - discovers and registers Azure AKS Kubernetes Clusters.
    - types: ["aks"]
      # Azure regions to search for resources from. Valid options are:
      # '*' - discovers resources in all regions (default).
      # Any valid Azure region name. List all valid regions using the Azure "az" cli: `az account list-locations -o table`
      regions: ["*"]
      # Azure subscription IDs to search resources from. Valid options are:
      # '*' - discovers resources in all subscriptions (default).
      # Any subscription_id: `az account subscription list -o table`
      subscriptions: ["*"]
      # Azure resource groups to search resources from. Valid options are:
      # '*' - discovers resources in all resource groups within configured subscription(s) (default).
      # Any resource_groups: `az group list -o table`
      resource_groups: ["*"]
      # Azure resource tag filters used to match resources.
      # Optional section: Defaults to "*":"*"
      tags:
        "env": "prod"
    # Matchers for discovering GCP-hosted resources.
    gcp:
      # GCP resource types. Valid options are:
      # 'gke' - discovers and registers GCP GKE Kubernetes Clusters.
    - types: ["gke"]
      # GCP location to search for resources from. Valid options are:
      # '*' - discovers resources in all locations (default).
      # Any valid GCP region or zone name.
      locations: ["*"]
      # GCP project ID
      project_ids: ["myproject"]
      # GCP resource tag filters used to match resources.
      # Optional section: Defaults to "*":"*"
      tags:
        "*" : "*"

Kubernetes 클러스터로 요청 전달#

Teleport Kubernetes Service는 Discovery Service가 생성하거나 업데이트한 동적 리소스를 모니터링하고 해당 리소스가 나타내는 Kubernetes 클러스터로 요청을 전달하는 역할을 합니다. 올바르게 작동하려면 대상 Kubernetes 클러스터에 대한 직접 접근과 요청을 전달할 수 있는 권한이 필요합니다.

Kubernetes Service에서 동적 리소스 모니터링을 활성화하려면 다음 스니펫과 같이 kubernetes_service.resources 섹션을 설정해야 합니다:

## This section configures the Kubernetes Service
kubernetes_service:
    enabled: true
    # Matchers for dynamic Kubernetes cluster resources created with the "tctl create" command or by Kubernetes auto-discovery.
    resources:
    - labels:
        "*": "*" # can be configured to limit the clusters to watched by this service.
      aws:
       # AWS role to assume when accessing EKS clusters in the AWS Account.
       # This value is an optional AWS role ARN to assume when forwarding requests
       # to EKS clusters.
       assume_role_arn: arn:aws:iam::123456789012:role/iam-discovery-role
       # External ID is an optional value that should be set when accessing
	     # your AWS account from a third-party service (delegated access).
       external_id: "example-external-id"

kubernetes_service.resources 매개변수를 설정하면 Teleport Kubernetes Service는 Teleport Discovery Service가 검색한 EKS 클러스터를 모니터링하도록 설정됩니다. 모니터링 프로세스는 레이블 매칭 메커니즘을 사용하여 EKS 클러스터를 식별하고 관리합니다.

  1. 검색 및 레이블 매칭: Discovery Service는 AWS 환경 내에서 사용 가능한 EKS 클러스터를 식별합니다. Teleport Kubernetes Service는 이 클러스터의 레이블을 선택기 배열kubernetes_service.resources[].labels 설정에 지정된 레이블과 비교합니다.
  2. 역할 선택: EKS 클러스터의 레이블과 일치하는 배열의 첫 번째 선택기가 Kubernetes Service가 위임할 역할을 결정합니다. 이 역할은 Teleport Kubernetes Service가 AWS API에서 필요한 클러스터 세부 정보를 가져오기 위해 필수적입니다. 일치하는 항목이 없으면 Kubernetes Service는 자체 ID를 기본으로 사용합니다.
  3. AWS 및 Kubernetes API와의 상호작용: 일치 항목이 발견되고 역할이 위임되면 Teleport Kubernetes Service는 이 역할을 사용하여 AWS API에 접근합니다. 설정 및 상태와 같은 EKS 클러스터에 대한 정보를 가져옵니다. 이후 Teleport Kubernetes Service는 클러스터와의 상호작용을 가능하게 하는 Kubernetes API로 요청을 전달합니다.

Discovery Service와 Kubernetes Service 모두 동일한 Teleport 프로세스 또는 별도의 프로세스에서 설정할 수 있습니다.