Перейти к основному содержимому
selectel_mks_kubeconfig_v1
Последнее изменение:

selectel_mks_kubeconfig_v1

к сведению

Эта инструкция — копия документации Selectel Terraform-провайдера в Terraform Registry.

Provides a kubeconfig file and its fields for a Managed Kubernetes cluster. For more information about Managed Kubernetes, see the official Selectel documentation.

Example Usage

Output kubeconfig

data "selectel_mks_kubeconfig_v1" "kubeconfig" {
cluster_id = selectel_mks_cluster_v1.cluster_1.id
project_id = selectel_mks_cluster_v1.cluster_1.project_id
region = selectel_mks_cluster_v1.cluster_1.region
}

output "kubeconfig" {
value = data.selectel_mks_kubeconfig_v1.kubeconfig.raw_config
}

Using a Kubernetes provider

data "selectel_mks_kubeconfig_v1" "kubeconfig" {
cluster_id = selectel_mks_cluster_v1.cluster_1.id
project_id = selectel_mks_cluster_v1.cluster_1.project_id
region = selectel_mks_cluster_v1.cluster_1.region
}

provider "kubernetes" {
host = data.selectel_mks_kubeconfig_v1.kubeconfig.server
client_certificate = data.selectel_mks_kubeconfig_v1.kubeconfig.cluster_ca_cert
client_key = data.selectel_mks_kubeconfig_v1.kubeconfig.client_key
cluster_ca_certificate = data.selectel_mks_kubeconfig_v1.kubeconfig.client_cert
}

output "kubeconfig" {
value = data.selectel_mks_kubeconfig_v1.kubeconfig.raw_config
}

Argument Reference

  • cluster_id - (Required) Unique identifier of the cluster.

  • project_id - (Required) Unique identifier of the associated project. Retrieved from the selectel_vpc_project_v2 resource. Learn more about Projects.

  • region - (Required) Pool where the cluster is located, for example, ru-3. Learn more about available pools in the Availability matrix.

Attributes Reference

  • raw_config - Raw content of a kubeconfig file.

  • server - IP address and port for a Kube API server.

  • cluster_ca_cert - CA certificate of the cluster.

  • client_key - Client key for authorization.

  • client_cert - Client certificate for authorization.