Alibaba Cloud v3.75.0 published on Friday, Mar 7, 2025 by Pulumi
alicloud.cs.getServerlessKubernetesClusters
Explore with Pulumi AI
This data source provides a list Container Service Serverless Kubernetes Clusters on Alibaba Cloud.
NOTE: Available since 1.58.0
NOTE: From version 1.177.0+, We supported batch export of clusters’ kube config information by
kube_config_file_prefix.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
// Declare the data source
const k8sClusters = alicloud.cs.getServerlessKubernetesClusters({
    nameRegex: "my-first-k8s",
    outputFile: "my-first-k8s-json",
    kubeConfigFilePrefix: "~/.kube/serverless",
});
export const output = k8sClusters.then(k8sClusters => k8sClusters.clusters);
import pulumi
import pulumi_alicloud as alicloud
# Declare the data source
k8s_clusters = alicloud.cs.get_serverless_kubernetes_clusters(name_regex="my-first-k8s",
    output_file="my-first-k8s-json",
    kube_config_file_prefix="~/.kube/serverless")
pulumi.export("output", k8s_clusters.clusters)
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 {
		// Declare the data source
		k8sClusters, err := cs.GetServerlessKubernetesClusters(ctx, &cs.GetServerlessKubernetesClustersArgs{
			NameRegex:            pulumi.StringRef("my-first-k8s"),
			OutputFile:           pulumi.StringRef("my-first-k8s-json"),
			KubeConfigFilePrefix: pulumi.StringRef("~/.kube/serverless"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("output", k8sClusters.Clusters)
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() => 
{
    // Declare the data source
    var k8sClusters = AliCloud.CS.GetServerlessKubernetesClusters.Invoke(new()
    {
        NameRegex = "my-first-k8s",
        OutputFile = "my-first-k8s-json",
        KubeConfigFilePrefix = "~/.kube/serverless",
    });
    return new Dictionary<string, object?>
    {
        ["output"] = k8sClusters.Apply(getServerlessKubernetesClustersResult => getServerlessKubernetesClustersResult.Clusters),
    };
});
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.GetServerlessKubernetesClustersArgs;
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) {
        // Declare the data source
        final var k8sClusters = CsFunctions.getServerlessKubernetesClusters(GetServerlessKubernetesClustersArgs.builder()
            .nameRegex("my-first-k8s")
            .outputFile("my-first-k8s-json")
            .kubeConfigFilePrefix("~/.kube/serverless")
            .build());
        ctx.export("output", k8sClusters.applyValue(getServerlessKubernetesClustersResult -> getServerlessKubernetesClustersResult.clusters()));
    }
}
variables:
  # Declare the data source
  k8sClusters:
    fn::invoke:
      function: alicloud:cs:getServerlessKubernetesClusters
      arguments:
        nameRegex: my-first-k8s
        outputFile: my-first-k8s-json
        kubeConfigFilePrefix: ~/.kube/serverless
outputs:
  output: ${k8sClusters.clusters}
Using getServerlessKubernetesClusters
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 getServerlessKubernetesClusters(args: GetServerlessKubernetesClustersArgs, opts?: InvokeOptions): Promise<GetServerlessKubernetesClustersResult>
function getServerlessKubernetesClustersOutput(args: GetServerlessKubernetesClustersOutputArgs, opts?: InvokeOptions): Output<GetServerlessKubernetesClustersResult>def get_serverless_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) -> GetServerlessKubernetesClustersResult
def get_serverless_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[GetServerlessKubernetesClustersResult]func GetServerlessKubernetesClusters(ctx *Context, args *GetServerlessKubernetesClustersArgs, opts ...InvokeOption) (*GetServerlessKubernetesClustersResult, error)
func GetServerlessKubernetesClustersOutput(ctx *Context, args *GetServerlessKubernetesClustersOutputArgs, opts ...InvokeOption) GetServerlessKubernetesClustersResultOutput> Note: This function is named GetServerlessKubernetesClusters in the Go SDK.
public static class GetServerlessKubernetesClusters 
{
    public static Task<GetServerlessKubernetesClustersResult> InvokeAsync(GetServerlessKubernetesClustersArgs args, InvokeOptions? opts = null)
    public static Output<GetServerlessKubernetesClustersResult> Invoke(GetServerlessKubernetesClustersInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetServerlessKubernetesClustersResult> getServerlessKubernetesClusters(GetServerlessKubernetesClustersArgs args, InvokeOptions options)
public static Output<GetServerlessKubernetesClustersResult> getServerlessKubernetesClusters(GetServerlessKubernetesClustersArgs args, InvokeOptions options)
fn::invoke:
  function: alicloud:cs/getServerlessKubernetesClusters:getServerlessKubernetesClusters
  arguments:
    # arguments dictionaryThe following arguments are supported:
- EnableDetails bool
- Boolean, false by default, only idandnameare exported. Set to true if more details are needed, e.g.,deletion_protection,connections. See full list in attributes.
- Ids List<string>
- Cluster IDs to filter.
- KubeConfig stringFile Prefix 
- The path prefix of kube config. You could store kube config in a specified directory by specifying this field, like ~/.kube/serverless, then it will be named with~/.kube/serverless-clusterID-kubeconfig. From version 1.243.0, kube_config will not export kube_config if this field is not set. Please use the attribute output_file of new DataSourcealicloud.cs.getClusterCredentialto replace it
- NameRegex string
- A regex string to filter results by cluster name.
- OutputFile string
- File name where to save data source results (after running pulumi preview).
- EnableDetails bool
- Boolean, false by default, only idandnameare exported. Set to true if more details are needed, e.g.,deletion_protection,connections. See full list in attributes.
- Ids []string
- Cluster IDs to filter.
- KubeConfig stringFile Prefix 
- The path prefix of kube config. You could store kube config in a specified directory by specifying this field, like ~/.kube/serverless, then it will be named with~/.kube/serverless-clusterID-kubeconfig. From version 1.243.0, kube_config will not export kube_config if this field is not set. Please use the attribute output_file of new DataSourcealicloud.cs.getClusterCredentialto replace it
- NameRegex string
- A regex string to filter results by cluster name.
- OutputFile string
- File name where to save data source results (after running pulumi preview).
- enableDetails Boolean
- Boolean, false by default, only idandnameare exported. Set to true if more details are needed, e.g.,deletion_protection,connections. See full list in attributes.
- ids List<String>
- Cluster IDs to filter.
- kubeConfig StringFile Prefix 
- The path prefix of kube config. You could store kube config in a specified directory by specifying this field, like ~/.kube/serverless, then it will be named with~/.kube/serverless-clusterID-kubeconfig. From version 1.243.0, kube_config will not export kube_config if this field is not set. Please use the attribute output_file of new DataSourcealicloud.cs.getClusterCredentialto replace it
- nameRegex String
- A regex string to filter results by cluster name.
- outputFile String
- File name where to save data source results (after running pulumi preview).
- enableDetails boolean
- Boolean, false by default, only idandnameare exported. Set to true if more details are needed, e.g.,deletion_protection,connections. See full list in attributes.
- ids string[]
- Cluster IDs to filter.
- kubeConfig stringFile Prefix 
- The path prefix of kube config. You could store kube config in a specified directory by specifying this field, like ~/.kube/serverless, then it will be named with~/.kube/serverless-clusterID-kubeconfig. From version 1.243.0, kube_config will not export kube_config if this field is not set. Please use the attribute output_file of new DataSourcealicloud.cs.getClusterCredentialto replace it
- nameRegex string
- A regex string to filter results by cluster name.
- outputFile string
- File name where to save data source results (after running pulumi preview).
- enable_details bool
- Boolean, false by default, only idandnameare exported. Set to true if more details are needed, e.g.,deletion_protection,connections. See full list in attributes.
- ids Sequence[str]
- Cluster IDs to filter.
- kube_config_ strfile_ prefix 
- The path prefix of kube config. You could store kube config in a specified directory by specifying this field, like ~/.kube/serverless, then it will be named with~/.kube/serverless-clusterID-kubeconfig. From version 1.243.0, kube_config will not export kube_config if this field is not set. Please use the attribute output_file of new DataSourcealicloud.cs.getClusterCredentialto replace it
- name_regex str
- A regex string to filter results by cluster name.
- output_file str
- File name where to save data source results (after running pulumi preview).
- enableDetails Boolean
- Boolean, false by default, only idandnameare exported. Set to true if more details are needed, e.g.,deletion_protection,connections. See full list in attributes.
- ids List<String>
- Cluster IDs to filter.
- kubeConfig StringFile Prefix 
- The path prefix of kube config. You could store kube config in a specified directory by specifying this field, like ~/.kube/serverless, then it will be named with~/.kube/serverless-clusterID-kubeconfig. From version 1.243.0, kube_config will not export kube_config if this field is not set. Please use the attribute output_file of new DataSourcealicloud.cs.getClusterCredentialto replace it
- nameRegex String
- A regex string to filter results by cluster name.
- outputFile String
- File name where to save data source results (after running pulumi preview).
getServerlessKubernetesClusters Result
The following output properties are available:
- Clusters
List<Pulumi.Ali Cloud. CS. Outputs. Get Serverless Kubernetes Clusters Cluster> 
- 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
- KubeConfig stringFile Prefix 
- NameRegex string
- OutputFile string
- Clusters
[]GetServerless Kubernetes Clusters Cluster 
- 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
- KubeConfig stringFile Prefix 
- NameRegex string
- OutputFile string
- clusters
List<GetServerless Kubernetes Clusters Cluster> 
- 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
- kubeConfig StringFile Prefix 
- nameRegex String
- outputFile String
- clusters
GetServerless Kubernetes Clusters Cluster[] 
- 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
- kubeConfig stringFile Prefix 
- nameRegex string
- outputFile string
- clusters
Sequence[GetServerless Kubernetes Clusters Cluster] 
- 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_ strfile_ prefix 
- 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
- kubeConfig StringFile Prefix 
- nameRegex String
- outputFile String
Supporting Types
GetServerlessKubernetesClustersCluster    
- Connections
Pulumi.Ali Cloud. CS. Inputs. Get Serverless Kubernetes Clusters Cluster Connections 
- Map of serverless cluster connection information. It contains several attributes to Block Connections.
- DeletionProtection bool
- Whether the cluster support delete protection.
- EndpointPublic boolAccess Enabled 
- Id string
- The ID of the container cluster.
- Name string
- The name of the container cluster.
- NatGateway stringId 
- The ID of nat gateway used to launch kubernetes cluster.
- SecurityGroup stringId 
- The ID of security group where the current cluster is located.
- Dictionary<string, string>
- VpcId string
- The ID of VPC where the current cluster is located.
- VswitchId string
- The ID of vSwitch where the current cluster is located.
- Connections
GetServerless Kubernetes Clusters Cluster Connections 
- Map of serverless cluster connection information. It contains several attributes to Block Connections.
- DeletionProtection bool
- Whether the cluster support delete protection.
- EndpointPublic boolAccess Enabled 
- Id string
- The ID of the container cluster.
- Name string
- The name of the container cluster.
- NatGateway stringId 
- The ID of nat gateway used to launch kubernetes cluster.
- SecurityGroup stringId 
- The ID of security group where the current cluster is located.
- map[string]string
- VpcId string
- The ID of VPC where the current cluster is located.
- VswitchId string
- The ID of vSwitch where the current cluster is located.
- connections
GetServerless Kubernetes Clusters Cluster Connections 
- Map of serverless cluster connection information. It contains several attributes to Block Connections.
- deletionProtection Boolean
- Whether the cluster support delete protection.
- endpointPublic BooleanAccess Enabled 
- id String
- The ID of the container cluster.
- name String
- The name of the container cluster.
- natGateway StringId 
- The ID of nat gateway used to launch kubernetes cluster.
- securityGroup StringId 
- The ID of security group where the current cluster is located.
- Map<String,String>
- vpcId String
- The ID of VPC where the current cluster is located.
- vswitchId String
- The ID of vSwitch where the current cluster is located.
- connections
GetServerless Kubernetes Clusters Cluster Connections 
- Map of serverless cluster connection information. It contains several attributes to Block Connections.
- deletionProtection boolean
- Whether the cluster support delete protection.
- endpointPublic booleanAccess Enabled 
- id string
- The ID of the container cluster.
- name string
- The name of the container cluster.
- natGateway stringId 
- The ID of nat gateway used to launch kubernetes cluster.
- securityGroup stringId 
- The ID of security group where the current cluster is located.
- {[key: string]: string}
- vpcId string
- The ID of VPC where the current cluster is located.
- vswitchId string
- The ID of vSwitch where the current cluster is located.
- connections
GetServerless Kubernetes Clusters Cluster Connections 
- Map of serverless cluster connection information. It contains several attributes to Block Connections.
- deletion_protection bool
- Whether the cluster support delete protection.
- endpoint_public_ boolaccess_ enabled 
- id str
- The ID of the container cluster.
- name str
- The name of the container cluster.
- nat_gateway_ strid 
- The ID of nat gateway used to launch kubernetes cluster.
- security_group_ strid 
- The ID of security group where the current cluster is located.
- Mapping[str, str]
- vpc_id str
- The ID of VPC where the current cluster is located.
- vswitch_id str
- The ID of vSwitch where the current cluster is located.
- connections Property Map
- Map of serverless cluster connection information. It contains several attributes to Block Connections.
- deletionProtection Boolean
- Whether the cluster support delete protection.
- endpointPublic BooleanAccess Enabled 
- id String
- The ID of the container cluster.
- name String
- The name of the container cluster.
- natGateway StringId 
- The ID of nat gateway used to launch kubernetes cluster.
- securityGroup StringId 
- The ID of security group where the current cluster is located.
- Map<String>
- vpcId String
- The ID of VPC where the current cluster is located.
- vswitchId String
- The ID of vSwitch where the current cluster is located.
GetServerlessKubernetesClustersClusterConnections     
- ApiServer stringInternet 
- API Server Internet endpoint.
- ApiServer stringIntranet 
- API Server Intranet endpoint.
- MasterPublic stringIp 
- Master node SSH IP address.
- ApiServer stringInternet 
- API Server Internet endpoint.
- ApiServer stringIntranet 
- API Server Intranet endpoint.
- MasterPublic stringIp 
- Master node SSH IP address.
- apiServer StringInternet 
- API Server Internet endpoint.
- apiServer StringIntranet 
- API Server Intranet endpoint.
- masterPublic StringIp 
- Master node SSH IP address.
- apiServer stringInternet 
- API Server Internet endpoint.
- apiServer stringIntranet 
- API Server Intranet endpoint.
- masterPublic stringIp 
- Master node SSH IP address.
- api_server_ strinternet 
- API Server Internet endpoint.
- api_server_ strintranet 
- API Server Intranet endpoint.
- master_public_ strip 
- Master node SSH IP address.
- apiServer StringInternet 
- API Server Internet endpoint.
- apiServer StringIntranet 
- API Server Intranet endpoint.
- masterPublic StringIp 
- Master node SSH IP address.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the alicloudTerraform Provider.