Alibaba Cloud

Pulumi Official
Package maintained by Pulumi
v3.28.0 published on Tuesday, Aug 16, 2022 by Pulumi

getManagedKubernetesClusters

This data source provides a list Container Service Managed Kubernetes Clusters on Alibaba Cloud.

NOTE: Available in v1.35.0+

NOTE: From version 1.177.0+, We supported batch export of clusters’ kube config information by kube_config_file_prefix.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var k8sClusters = Output.Create(AliCloud.CS.GetManagedKubernetesClusters.InvokeAsync(new AliCloud.CS.GetManagedKubernetesClustersArgs
        {
            KubeConfigFilePrefix = "~/.kube/managed",
            NameRegex = "my-first-k8s",
            OutputFile = "my-first-k8s-json",
        }));
        this.Output = k8sClusters.Apply(k8sClusters => k8sClusters.Clusters);
    }

    [Output("output")]
    public Output<string> Output { get; set; }
}
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cs"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		k8sClusters, err := cs.GetManagedKubernetesClusters(ctx, &cs.GetManagedKubernetesClustersArgs{
			KubeConfigFilePrefix: pulumi.StringRef("~/.kube/managed"),
			NameRegex:            pulumi.StringRef("my-first-k8s"),
			OutputFile:           pulumi.StringRef("my-first-k8s-json"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("output", k8sClusters.Clusters)
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.cs.CsFunctions;
import com.pulumi.alicloud.cs.inputs.GetManagedKubernetesClustersArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var k8sClusters = CsFunctions.getManagedKubernetesClusters(GetManagedKubernetesClustersArgs.builder()
            .kubeConfigFilePrefix("~/.kube/managed")
            .nameRegex("my-first-k8s")
            .outputFile("my-first-k8s-json")
            .build());

        ctx.export("output", k8sClusters.applyValue(getManagedKubernetesClustersResult -> getManagedKubernetesClustersResult.clusters()));
    }
}
import pulumi
import pulumi_alicloud as alicloud

k8s_clusters = alicloud.cs.get_managed_kubernetes_clusters(kube_config_file_prefix="~/.kube/managed",
    name_regex="my-first-k8s",
    output_file="my-first-k8s-json")
pulumi.export("output", k8s_clusters.clusters)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

// Declare the data source
const k8sClusters = pulumi.output(alicloud.cs.getManagedKubernetesClusters({
    kubeConfigFilePrefix: "~/.kube/managed",
    nameRegex: "my-first-k8s",
    outputFile: "my-first-k8s-json",
}));

export const output = k8sClusters.clusters;
variables:
  k8sClusters:
    Fn::Invoke:
      Function: alicloud:cs:getManagedKubernetesClusters
      Arguments:
        kubeConfigFilePrefix: ~/.kube/managed
        nameRegex: my-first-k8s
        outputFile: my-first-k8s-json
outputs:
  output: ${k8sClusters.clusters}

Using getManagedKubernetesClusters

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getManagedKubernetesClusters(args: GetManagedKubernetesClustersArgs, opts?: InvokeOptions): Promise<GetManagedKubernetesClustersResult>
function getManagedKubernetesClustersOutput(args: GetManagedKubernetesClustersOutputArgs, opts?: InvokeOptions): Output<GetManagedKubernetesClustersResult>
def get_managed_kubernetes_clusters(enable_details: Optional[bool] = None,
                                    ids: Optional[Sequence[str]] = None,
                                    kube_config_file_prefix: Optional[str] = None,
                                    name_regex: Optional[str] = None,
                                    output_file: Optional[str] = None,
                                    opts: Optional[InvokeOptions] = None) -> GetManagedKubernetesClustersResult
def get_managed_kubernetes_clusters_output(enable_details: Optional[pulumi.Input[bool]] = None,
                                    ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                                    kube_config_file_prefix: Optional[pulumi.Input[str]] = None,
                                    name_regex: Optional[pulumi.Input[str]] = None,
                                    output_file: Optional[pulumi.Input[str]] = None,
                                    opts: Optional[InvokeOptions] = None) -> Output[GetManagedKubernetesClustersResult]
func GetManagedKubernetesClusters(ctx *Context, args *GetManagedKubernetesClustersArgs, opts ...InvokeOption) (*GetManagedKubernetesClustersResult, error)
func GetManagedKubernetesClustersOutput(ctx *Context, args *GetManagedKubernetesClustersOutputArgs, opts ...InvokeOption) GetManagedKubernetesClustersResultOutput

> Note: This function is named GetManagedKubernetesClusters in the Go SDK.

public static class GetManagedKubernetesClusters 
{
    public static Task<GetManagedKubernetesClustersResult> InvokeAsync(GetManagedKubernetesClustersArgs args, InvokeOptions? opts = null)
    public static Output<GetManagedKubernetesClustersResult> Invoke(GetManagedKubernetesClustersInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetManagedKubernetesClustersResult> getManagedKubernetesClusters(GetManagedKubernetesClustersArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: alicloud:cs/getManagedKubernetesClusters:getManagedKubernetesClusters
  Arguments:
    # Arguments dictionary

The following arguments are supported:

EnableDetails bool
Ids List<string>

Cluster IDs to filter.

KubeConfigFilePrefix string

The path prefix of kube config. You could store kube config in a specified directory by specifying this field, like ~/.kube/managed, then it will be named with ~/.kube/managed-clusterID-kubeconfig. If you don't specify this field, it will be stored in the current directory and named with clusterID-kubeconfig.

NameRegex string

A regex string to filter results by cluster name.

OutputFile string
EnableDetails bool
Ids []string

Cluster IDs to filter.

KubeConfigFilePrefix string

The path prefix of kube config. You could store kube config in a specified directory by specifying this field, like ~/.kube/managed, then it will be named with ~/.kube/managed-clusterID-kubeconfig. If you don't specify this field, it will be stored in the current directory and named with clusterID-kubeconfig.

NameRegex string

A regex string to filter results by cluster name.

OutputFile string
enableDetails Boolean
ids List<String>

Cluster IDs to filter.

kubeConfigFilePrefix String

The path prefix of kube config. You could store kube config in a specified directory by specifying this field, like ~/.kube/managed, then it will be named with ~/.kube/managed-clusterID-kubeconfig. If you don't specify this field, it will be stored in the current directory and named with clusterID-kubeconfig.

nameRegex String

A regex string to filter results by cluster name.

outputFile String
enableDetails boolean
ids string[]

Cluster IDs to filter.

kubeConfigFilePrefix string

The path prefix of kube config. You could store kube config in a specified directory by specifying this field, like ~/.kube/managed, then it will be named with ~/.kube/managed-clusterID-kubeconfig. If you don't specify this field, it will be stored in the current directory and named with clusterID-kubeconfig.

nameRegex string

A regex string to filter results by cluster name.

outputFile string
enable_details bool
ids Sequence[str]

Cluster IDs to filter.

kube_config_file_prefix str

The path prefix of kube config. You could store kube config in a specified directory by specifying this field, like ~/.kube/managed, then it will be named with ~/.kube/managed-clusterID-kubeconfig. If you don't specify this field, it will be stored in the current directory and named with clusterID-kubeconfig.

name_regex str

A regex string to filter results by cluster name.

output_file str
enableDetails Boolean
ids List<String>

Cluster IDs to filter.

kubeConfigFilePrefix String

The path prefix of kube config. You could store kube config in a specified directory by specifying this field, like ~/.kube/managed, then it will be named with ~/.kube/managed-clusterID-kubeconfig. If you don't specify this field, it will be stored in the current directory and named with clusterID-kubeconfig.

nameRegex String

A regex string to filter results by cluster name.

outputFile String

getManagedKubernetesClusters Result

The following output properties are available:

Clusters List<Pulumi.AliCloud.CS.Outputs.GetManagedKubernetesClustersCluster>

A list of matched Kubernetes clusters. Each element contains the following attributes:

Id string

The provider-assigned unique ID for this managed resource.

Ids List<string>

A list of matched Kubernetes clusters' ids.

Names List<string>

A list of matched Kubernetes clusters' names.

EnableDetails bool
KubeConfigFilePrefix string
NameRegex string
OutputFile string
Clusters []GetManagedKubernetesClustersCluster

A list of matched Kubernetes clusters. Each element contains the following attributes:

Id string

The provider-assigned unique ID for this managed resource.

Ids []string

A list of matched Kubernetes clusters' ids.

Names []string

A list of matched Kubernetes clusters' names.

EnableDetails bool
KubeConfigFilePrefix string
NameRegex string
OutputFile string
clusters List<GetManagedKubernetesClustersCluster>

A list of matched Kubernetes clusters. Each element contains the following attributes:

id String

The provider-assigned unique ID for this managed resource.

ids List<String>

A list of matched Kubernetes clusters' ids.

names List<String>

A list of matched Kubernetes clusters' names.

enableDetails Boolean
kubeConfigFilePrefix String
nameRegex String
outputFile String
clusters GetManagedKubernetesClustersCluster[]

A list of matched Kubernetes clusters. Each element contains the following attributes:

id string

The provider-assigned unique ID for this managed resource.

ids string[]

A list of matched Kubernetes clusters' ids.

names string[]

A list of matched Kubernetes clusters' names.

enableDetails boolean
kubeConfigFilePrefix string
nameRegex string
outputFile string
clusters Sequence[GetManagedKubernetesClustersCluster]

A list of matched Kubernetes clusters. Each element contains the following attributes:

id str

The provider-assigned unique ID for this managed resource.

ids Sequence[str]

A list of matched Kubernetes clusters' ids.

names Sequence[str]

A list of matched Kubernetes clusters' names.

enable_details bool
kube_config_file_prefix str
name_regex str
output_file str
clusters List<Property Map>

A list of matched Kubernetes clusters. Each element contains the following attributes:

id String

The provider-assigned unique ID for this managed resource.

ids List<String>

A list of matched Kubernetes clusters' ids.

names List<String>

A list of matched Kubernetes clusters' names.

enableDetails Boolean
kubeConfigFilePrefix String
nameRegex String
outputFile String

Supporting Types

GetManagedKubernetesClustersCluster

AvailabilityZone string

The ID of availability zone.

ClusterNetworkType string
Connections Pulumi.AliCloud.CS.Inputs.GetManagedKubernetesClustersClusterConnections

Map of kubernetes cluster connection information. It contains several attributes to Block Connections.

Id string

ID of the node.

ImageId string
KeyName string

The keypair of ssh login cluster node, you have to create it first.

LogConfigs List<Pulumi.AliCloud.CS.Inputs.GetManagedKubernetesClustersClusterLogConfig>

A list of one element containing information about the associated log store. It contains the following attributes:

Name string

Node name.

NatGatewayId string

The ID of nat gateway used to launch kubernetes cluster.

PodCidr string
SecurityGroupId string

The ID of security group where the current cluster worker node is located.

ServiceCidr string
SlbInternetEnabled bool
VpcId string

The ID of VPC where the current cluster is located.

VswitchIds List<string>

The ID of VSwitches where the current cluster is located.

WorkerAutoRenew bool
WorkerAutoRenewPeriod int
WorkerDataDiskCategory string
WorkerDataDiskSize int
WorkerDiskCategory string
WorkerDiskSize int
WorkerInstanceChargeType string
WorkerInstanceTypes List<string>
WorkerNodes List<Pulumi.AliCloud.CS.Inputs.GetManagedKubernetesClustersClusterWorkerNode>

List of cluster worker nodes. It contains several attributes to Block Nodes.

WorkerNumbers List<int>

The ECS instance node number in the current container cluster.

WorkerPeriod int
WorkerPeriodUnit string
AvailabilityZone string

The ID of availability zone.

ClusterNetworkType string
Connections GetManagedKubernetesClustersClusterConnections

Map of kubernetes cluster connection information. It contains several attributes to Block Connections.

Id string

ID of the node.

ImageId string
KeyName string

The keypair of ssh login cluster node, you have to create it first.

LogConfigs []GetManagedKubernetesClustersClusterLogConfig

A list of one element containing information about the associated log store. It contains the following attributes:

Name string

Node name.

NatGatewayId string

The ID of nat gateway used to launch kubernetes cluster.

PodCidr string
SecurityGroupId string

The ID of security group where the current cluster worker node is located.

ServiceCidr string
SlbInternetEnabled bool
VpcId string

The ID of VPC where the current cluster is located.

VswitchIds []string

The ID of VSwitches where the current cluster is located.

WorkerAutoRenew bool
WorkerAutoRenewPeriod int
WorkerDataDiskCategory string
WorkerDataDiskSize int
WorkerDiskCategory string
WorkerDiskSize int
WorkerInstanceChargeType string
WorkerInstanceTypes []string
WorkerNodes []GetManagedKubernetesClustersClusterWorkerNode

List of cluster worker nodes. It contains several attributes to Block Nodes.

WorkerNumbers []int

The ECS instance node number in the current container cluster.

WorkerPeriod int
WorkerPeriodUnit string
availabilityZone String

The ID of availability zone.

clusterNetworkType String
connections GetManagedKubernetesClustersClusterConnections

Map of kubernetes cluster connection information. It contains several attributes to Block Connections.

id String

ID of the node.

imageId String
keyName String

The keypair of ssh login cluster node, you have to create it first.

logConfigs List<GetManagedKubernetesClustersClusterLogConfig>

A list of one element containing information about the associated log store. It contains the following attributes:

name String

Node name.

natGatewayId String

The ID of nat gateway used to launch kubernetes cluster.

podCidr String
securityGroupId String

The ID of security group where the current cluster worker node is located.

serviceCidr String
slbInternetEnabled Boolean
vpcId String

The ID of VPC where the current cluster is located.

vswitchIds List<String>

The ID of VSwitches where the current cluster is located.

workerAutoRenew Boolean
workerAutoRenewPeriod Integer
workerDataDiskCategory String
workerDataDiskSize Integer
workerDiskCategory String
workerDiskSize Integer
workerInstanceChargeType String
workerInstanceTypes List<String>
workerNodes List<GetManagedKubernetesClustersClusterWorkerNode>

List of cluster worker nodes. It contains several attributes to Block Nodes.

workerNumbers List<Integer>

The ECS instance node number in the current container cluster.

workerPeriod Integer
workerPeriodUnit String
availabilityZone string

The ID of availability zone.

clusterNetworkType string
connections GetManagedKubernetesClustersClusterConnections

Map of kubernetes cluster connection information. It contains several attributes to Block Connections.

id string

ID of the node.

imageId string
keyName string

The keypair of ssh login cluster node, you have to create it first.

logConfigs GetManagedKubernetesClustersClusterLogConfig[]

A list of one element containing information about the associated log store. It contains the following attributes:

name string

Node name.

natGatewayId string

The ID of nat gateway used to launch kubernetes cluster.

podCidr string
securityGroupId string

The ID of security group where the current cluster worker node is located.

serviceCidr string
slbInternetEnabled boolean
vpcId string

The ID of VPC where the current cluster is located.

vswitchIds string[]

The ID of VSwitches where the current cluster is located.

workerAutoRenew boolean
workerAutoRenewPeriod number
workerDataDiskCategory string
workerDataDiskSize number
workerDiskCategory string
workerDiskSize number
workerInstanceChargeType string
workerInstanceTypes string[]
workerNodes GetManagedKubernetesClustersClusterWorkerNode[]

List of cluster worker nodes. It contains several attributes to Block Nodes.

workerNumbers number[]

The ECS instance node number in the current container cluster.

workerPeriod number
workerPeriodUnit string
availability_zone str

The ID of availability zone.

cluster_network_type str
connections GetManagedKubernetesClustersClusterConnections

Map of kubernetes cluster connection information. It contains several attributes to Block Connections.

id str

ID of the node.

image_id str
key_name str

The keypair of ssh login cluster node, you have to create it first.

log_configs Sequence[GetManagedKubernetesClustersClusterLogConfig]

A list of one element containing information about the associated log store. It contains the following attributes:

name str

Node name.

nat_gateway_id str

The ID of nat gateway used to launch kubernetes cluster.

pod_cidr str
security_group_id str

The ID of security group where the current cluster worker node is located.

service_cidr str
slb_internet_enabled bool
vpc_id str

The ID of VPC where the current cluster is located.

vswitch_ids Sequence[str]

The ID of VSwitches where the current cluster is located.

worker_auto_renew bool
worker_auto_renew_period int
worker_data_disk_category str
worker_data_disk_size int
worker_disk_category str
worker_disk_size int
worker_instance_charge_type str
worker_instance_types Sequence[str]
worker_nodes Sequence[GetManagedKubernetesClustersClusterWorkerNode]

List of cluster worker nodes. It contains several attributes to Block Nodes.

worker_numbers Sequence[int]

The ECS instance node number in the current container cluster.

worker_period int
worker_period_unit str
availabilityZone String

The ID of availability zone.

clusterNetworkType String
connections Property Map

Map of kubernetes cluster connection information. It contains several attributes to Block Connections.

id String

ID of the node.

imageId String
keyName String

The keypair of ssh login cluster node, you have to create it first.

logConfigs List<Property Map>

A list of one element containing information about the associated log store. It contains the following attributes:

name String

Node name.

natGatewayId String

The ID of nat gateway used to launch kubernetes cluster.

podCidr String
securityGroupId String

The ID of security group where the current cluster worker node is located.

serviceCidr String
slbInternetEnabled Boolean
vpcId String

The ID of VPC where the current cluster is located.

vswitchIds List<String>

The ID of VSwitches where the current cluster is located.

workerAutoRenew Boolean
workerAutoRenewPeriod Number
workerDataDiskCategory String
workerDataDiskSize Number
workerDiskCategory String
workerDiskSize Number
workerInstanceChargeType String
workerInstanceTypes List<String>
workerNodes List<Property Map>

List of cluster worker nodes. It contains several attributes to Block Nodes.

workerNumbers List<Number>

The ECS instance node number in the current container cluster.

workerPeriod Number
workerPeriodUnit String

GetManagedKubernetesClustersClusterConnections

ApiServerInternet string

API Server Internet endpoint.

ApiServerIntranet string

API Server Intranet endpoint.

MasterPublicIp string

Master node SSH IP address.

ServiceDomain string

Service Access Domain.

ApiServerInternet string

API Server Internet endpoint.

ApiServerIntranet string

API Server Intranet endpoint.

MasterPublicIp string

Master node SSH IP address.

ServiceDomain string

Service Access Domain.

apiServerInternet String

API Server Internet endpoint.

apiServerIntranet String

API Server Intranet endpoint.

masterPublicIp String

Master node SSH IP address.

serviceDomain String

Service Access Domain.

apiServerInternet string

API Server Internet endpoint.

apiServerIntranet string

API Server Intranet endpoint.

masterPublicIp string

Master node SSH IP address.

serviceDomain string

Service Access Domain.

api_server_internet str

API Server Internet endpoint.

api_server_intranet str

API Server Intranet endpoint.

master_public_ip str

Master node SSH IP address.

service_domain str

Service Access Domain.

apiServerInternet String

API Server Internet endpoint.

apiServerIntranet String

API Server Intranet endpoint.

masterPublicIp String

Master node SSH IP address.

serviceDomain String

Service Access Domain.

GetManagedKubernetesClustersClusterLogConfig

Project string

Log Service project name.

Type string

Type of collecting logs.

Project string

Log Service project name.

Type string

Type of collecting logs.

project String

Log Service project name.

type String

Type of collecting logs.

project string

Log Service project name.

type string

Type of collecting logs.

project str

Log Service project name.

type str

Type of collecting logs.

project String

Log Service project name.

type String

Type of collecting logs.

GetManagedKubernetesClustersClusterWorkerNode

Id string

ID of the node.

Name string

Node name.

PrivateIp string

The private IP address of node.

Id string

ID of the node.

Name string

Node name.

PrivateIp string

The private IP address of node.

id String

ID of the node.

name String

Node name.

privateIp String

The private IP address of node.

id string

ID of the node.

name string

Node name.

privateIp string

The private IP address of node.

id str

ID of the node.

name str

Node name.

private_ip str

The private IP address of node.

id String

ID of the node.

name String

Node name.

privateIp String

The private IP address of node.

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.