InfoGrab DocsInfoGrab Docs

Azure Kubernetes Service 클러스터 검색 및 접근하기

요약

이 페이지는 teleport-discovery-azure Terraform 모듈의 사용 예시인 aks-discovery-access의 구성 필드를 나열합니다. 이 예시는 AKS 검색을 구성하고 Azure Container Instances에 Teleport 쿠버네티스 서비스를 배포하여 검색된 클러스터에 접근합니다.

이 페이지는 teleport-discovery-azure Terraform 모듈의 사용 예시인 aks-discovery-access의 구성 필드를 나열합니다.

Azure Kubernetes Service 클러스터 검색 및 접근 예시#

이 예시는 AKS 검색을 구성하고 Azure Container Instances에 Teleport 쿠버네티스 서비스를 배포하여 검색된 클러스터에 접근합니다.

검색 모듈은 관리형 아이덴티티, 검색 권한, Teleport OIDC 연동 및 검색 구성을 생성합니다. 에이전트 모듈은 별도의 관리형 아이덴티티와 AKS 접근 권한을 갖춘 쿠버네티스 서비스를 배포합니다.

검색 모듈은 azure_matchers에 정의된 태그를 사용하여 등록할 AKS 클러스터를 필터링합니다. 쿠버네티스 서비스는 동일한 검색 그룹, 구독, 리소스 그룹, 리전에 등록된 AKS 클러스터를 선택합니다. 여기에는 해당 그룹의 다른 검색 구성이 등록한 일치하는 클러스터도 포함될 수 있습니다.

요구 사항#

이름 버전
terraform >= 1.5.7
azurerm >= 5.0
http >= 3.0
random >= 3.0
teleport >= 18.11.0

공급자 (Providers)#

이름 버전
azurerm >= 5.0

모듈 (Modules)#

이름 소스 버전
azure_agent ../../../../agent/azure n/a
azure_discovery ../.. n/a

리소스 (Resources)#

입력 (Inputs)#

이름 설명 유형 기본값 필수
teleport_proxy_addr host:port 형식의 Teleport 프록시 서비스 주소입니다. string n/a yes

출력 (Outputs)#

이름 설명
azure_agent 쿠버네티스 서비스 아이덴티티, 컨테이너 배포, 그리고 해당 로그를 따라가는 명령입니다.
azure_discovery 검색 구성, OIDC 연동, Azure 검색 아이덴티티입니다.

소스 코드#

GitHub에서 teleport-discovery-azure 모듈의 aks-discovery-access 예시 소스 코드 보기.

################################################################################
# teleport/discovery/azure/examples/aks-discovery-access/data.tf
################################################################################

data "azurerm_client_config" "current" {}

################################################################################
# teleport/discovery/azure/examples/aks-discovery-access/main.tf
################################################################################

locals {
  apply_azure_tags               = { origin = "example" }
  apply_teleport_resource_labels = { origin = "example" }

  # A Discovery Service watching this discovery group must already exist.
  # If you are using Teleport Cloud, you can use `cloud-discovery-group`.
  teleport_discovery_group = "discover-aks"
  matching_resource_groups = ["*"]
  matching_regions         = ["westus", "eastus"]
  matching_tags = {
    env = ["prod"]
  }
}

# Resource group that will be used to create resources related to the Discovery and Agent modules.
# You can use two resource groups if you want to separate the resources for the Discovery and Agent modules.
resource "azurerm_resource_group" "example" {
  name     = "teleport-aks-discovery-access"
  location = "eastus"
  tags     = local.apply_azure_tags
}

# Azure Discovery module creates the required resources for discovering AKS clusters.
# But it doesn't provide a way to access them (see the Azure Agent module below).
module "azure_discovery" {
  source  = "terraform.releases.teleport.dev/teleport/discovery/azure"
  version = "~> (=teleport.major_version=).0"

  teleport_proxy_public_addr    = var.teleport_proxy_addr
  teleport_discovery_group_name = local.teleport_discovery_group

  azure_resource_group_name       = azurerm_resource_group.example.name
  azure_managed_identity_location = azurerm_resource_group.example.location

  # Configure AKS matcher: resource groups, regions and tags to monitor.
  azure_matchers = [
    {
      types           = ["aks"]
      subscriptions   = [data.azurerm_client_config.current.subscription_id]
      resource_groups = local.matching_resource_groups
      regions         = local.matching_regions
      tags            = local.matching_tags
    }
  ]

  apply_azure_tags               = local.apply_azure_tags
  apply_teleport_resource_labels = local.apply_teleport_resource_labels
}

# Azure Agent module deploys a Kubernetes Service that will proxy the discovered AKS clusters, providing access to them.
module "azure_agent" {
  source  = "terraform.releases.teleport.dev/teleport/agent/azure"
  version = "~> (=teleport.major_version=).0"

  teleport_proxy_public_addr    = var.teleport_proxy_addr
  teleport_discovery_group_name = local.teleport_discovery_group

  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  apply_azure_tags    = local.apply_azure_tags

  container_group_name = "teleport-aks-access"

  # When setting up access to private AKS clusters, set subnet_id to the resource ID of the subnet which will host the Azure Container Instance.
  # The subnet must be delegated to Microsoft.ContainerInstance/containerGroups and have access to
  # - the Teleport Proxy Service (var.teleport_proxy_addr)
  # - the Teleport image registry at https://public.ecr.aws/
  # - Azure Resource Manager at https://management.azure.com/ (HTTPS/TCP 443) to read cluster details and fetch credentials
  # - the target AKS API endpoints (DNS resolution and connectivity)
  # subnet_id = <subnet_id>

  # Keep the labels in sync with the configuration in the discovery module under the azure_matchers.
  kubernetes_service = {
    enabled = true
    resource_matcher_labels = {
      "region"             = local.matching_regions
      "teleport.dev/cloud" = ["Azure"]
      "subscription-id"    = [data.azurerm_client_config.current.subscription_id]
      "resource-group"     = local.matching_resource_groups
    }
  }
}

################################################################################
# teleport/discovery/azure/examples/aks-discovery-access/outputs.tf
################################################################################

output "azure_discovery" {
  description = "Discovery configuration, OIDC integration, and Azure discovery identity."
  value       = module.azure_discovery
}

output "azure_agent" {
  description = "Kubernetes Service identity, container deployments, and commands to follow their logs."
  value       = module.azure_agent
}

################################################################################
# teleport/discovery/azure/examples/aks-discovery-access/providers.tf
################################################################################

provider "azurerm" {
  features {}
}

provider "teleport" {
  addr         = var.teleport_proxy_addr
  profile_name = replace(var.teleport_proxy_addr, "/:[0-9]+.*/", "")
}

################################################################################
# teleport/discovery/azure/examples/aks-discovery-access/variables.tf
################################################################################

variable "teleport_proxy_addr" {
  description = "The address of the Teleport Proxy Service in host:port form."
  type        = string
}

################################################################################
# teleport/discovery/azure/examples/aks-discovery-access/versions.tf
################################################################################

terraform {
  required_version = ">= 1.5.7"

  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = ">= 5.0"
    }

    http = {
      source  = "hashicorp/http"
      version = ">= 3.0"
    }

    random = {
      source  = "hashicorp/random"
      version = ">= 3.0"
    }

    teleport = {
      source  = "terraform.releases.teleport.dev/gravitational/teleport"
      version = ">= 18.11.0"
    }
  }
}

Azure Kubernetes Service 클러스터 검색 및 접근하기

Teleport v18.11
원문 보기

요약

이 페이지는 teleport-discovery-azure Terraform 모듈의 사용 예시인 aks-discovery-access의 구성 필드를 나열합니다. 이 예시는 AKS 검색을 구성하고 Azure Container Instances에 Teleport 쿠버네티스 서비스를 배포하여 검색된 클러스터에 접근합니다.

이 페이지는 teleport-discovery-azure Terraform 모듈의 사용 예시인 aks-discovery-access의 구성 필드를 나열합니다.

Azure Kubernetes Service 클러스터 검색 및 접근 예시#

이 예시는 AKS 검색을 구성하고 Azure Container Instances에 Teleport 쿠버네티스 서비스를 배포하여 검색된 클러스터에 접근합니다.

검색 모듈은 관리형 아이덴티티, 검색 권한, Teleport OIDC 연동 및 검색 구성을 생성합니다. 에이전트 모듈은 별도의 관리형 아이덴티티와 AKS 접근 권한을 갖춘 쿠버네티스 서비스를 배포합니다.

검색 모듈은 azure_matchers에 정의된 태그를 사용하여 등록할 AKS 클러스터를 필터링합니다. 쿠버네티스 서비스는 동일한 검색 그룹, 구독, 리소스 그룹, 리전에 등록된 AKS 클러스터를 선택합니다. 여기에는 해당 그룹의 다른 검색 구성이 등록한 일치하는 클러스터도 포함될 수 있습니다.

요구 사항#

이름 버전
terraform >= 1.5.7
azurerm >= 5.0
http >= 3.0
random >= 3.0
teleport >= 18.11.0

공급자 (Providers)#

이름 버전
azurerm >= 5.0

모듈 (Modules)#

이름 소스 버전
azure_agent ../../../../agent/azure n/a
azure_discovery ../.. n/a

리소스 (Resources)#

입력 (Inputs)#

이름 설명 유형 기본값 필수
teleport_proxy_addr host:port 형식의 Teleport 프록시 서비스 주소입니다. string n/a yes

출력 (Outputs)#

이름 설명
azure_agent 쿠버네티스 서비스 아이덴티티, 컨테이너 배포, 그리고 해당 로그를 따라가는 명령입니다.
azure_discovery 검색 구성, OIDC 연동, Azure 검색 아이덴티티입니다.

소스 코드#

GitHub에서 teleport-discovery-azure 모듈의 aks-discovery-access 예시 소스 코드 보기.

################################################################################
# teleport/discovery/azure/examples/aks-discovery-access/data.tf
################################################################################

data "azurerm_client_config" "current" {}

################################################################################
# teleport/discovery/azure/examples/aks-discovery-access/main.tf
################################################################################

locals {
  apply_azure_tags               = { origin = "example" }
  apply_teleport_resource_labels = { origin = "example" }

  # A Discovery Service watching this discovery group must already exist.
  # If you are using Teleport Cloud, you can use `cloud-discovery-group`.
  teleport_discovery_group = "discover-aks"
  matching_resource_groups = ["*"]
  matching_regions         = ["westus", "eastus"]
  matching_tags = {
    env = ["prod"]
  }
}

# Resource group that will be used to create resources related to the Discovery and Agent modules.
# You can use two resource groups if you want to separate the resources for the Discovery and Agent modules.
resource "azurerm_resource_group" "example" {
  name     = "teleport-aks-discovery-access"
  location = "eastus"
  tags     = local.apply_azure_tags
}

# Azure Discovery module creates the required resources for discovering AKS clusters.
# But it doesn't provide a way to access them (see the Azure Agent module below).
module "azure_discovery" {
  source  = "terraform.releases.teleport.dev/teleport/discovery/azure"
  version = "~> (=teleport.major_version=).0"

  teleport_proxy_public_addr    = var.teleport_proxy_addr
  teleport_discovery_group_name = local.teleport_discovery_group

  azure_resource_group_name       = azurerm_resource_group.example.name
  azure_managed_identity_location = azurerm_resource_group.example.location

  # Configure AKS matcher: resource groups, regions and tags to monitor.
  azure_matchers = [
    {
      types           = ["aks"]
      subscriptions   = [data.azurerm_client_config.current.subscription_id]
      resource_groups = local.matching_resource_groups
      regions         = local.matching_regions
      tags            = local.matching_tags
    }
  ]

  apply_azure_tags               = local.apply_azure_tags
  apply_teleport_resource_labels = local.apply_teleport_resource_labels
}

# Azure Agent module deploys a Kubernetes Service that will proxy the discovered AKS clusters, providing access to them.
module "azure_agent" {
  source  = "terraform.releases.teleport.dev/teleport/agent/azure"
  version = "~> (=teleport.major_version=).0"

  teleport_proxy_public_addr    = var.teleport_proxy_addr
  teleport_discovery_group_name = local.teleport_discovery_group

  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  apply_azure_tags    = local.apply_azure_tags

  container_group_name = "teleport-aks-access"

  # When setting up access to private AKS clusters, set subnet_id to the resource ID of the subnet which will host the Azure Container Instance.
  # The subnet must be delegated to Microsoft.ContainerInstance/containerGroups and have access to
  # - the Teleport Proxy Service (var.teleport_proxy_addr)
  # - the Teleport image registry at https://public.ecr.aws/
  # - Azure Resource Manager at https://management.azure.com/ (HTTPS/TCP 443) to read cluster details and fetch credentials
  # - the target AKS API endpoints (DNS resolution and connectivity)
  # subnet_id = <subnet_id>

  # Keep the labels in sync with the configuration in the discovery module under the azure_matchers.
  kubernetes_service = {
    enabled = true
    resource_matcher_labels = {
      "region"             = local.matching_regions
      "teleport.dev/cloud" = ["Azure"]
      "subscription-id"    = [data.azurerm_client_config.current.subscription_id]
      "resource-group"     = local.matching_resource_groups
    }
  }
}

################################################################################
# teleport/discovery/azure/examples/aks-discovery-access/outputs.tf
################################################################################

output "azure_discovery" {
  description = "Discovery configuration, OIDC integration, and Azure discovery identity."
  value       = module.azure_discovery
}

output "azure_agent" {
  description = "Kubernetes Service identity, container deployments, and commands to follow their logs."
  value       = module.azure_agent
}

################################################################################
# teleport/discovery/azure/examples/aks-discovery-access/providers.tf
################################################################################

provider "azurerm" {
  features {}
}

provider "teleport" {
  addr         = var.teleport_proxy_addr
  profile_name = replace(var.teleport_proxy_addr, "/:[0-9]+.*/", "")
}

################################################################################
# teleport/discovery/azure/examples/aks-discovery-access/variables.tf
################################################################################

variable "teleport_proxy_addr" {
  description = "The address of the Teleport Proxy Service in host:port form."
  type        = string
}

################################################################################
# teleport/discovery/azure/examples/aks-discovery-access/versions.tf
################################################################################

terraform {
  required_version = ">= 1.5.7"

  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = ">= 5.0"
    }

    http = {
      source  = "hashicorp/http"
      version = ">= 3.0"
    }

    random = {
      source  = "hashicorp/random"
      version = ">= 3.0"
    }

    teleport = {
      source  = "terraform.releases.teleport.dev/gravitational/teleport"
      version = ">= 18.11.0"
    }
  }
}