1. Packages
  2. Selectel Provider
  3. API Docs
  4. getMksKubeconfigV1
selectel 6.4.0 published on Monday, Apr 14, 2025 by selectel

selectel.getMksKubeconfigV1

Explore with Pulumi AI

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

import * as pulumi from "@pulumi/pulumi";
import * as selectel from "@pulumi/selectel";

const kubeconfigMksKubeconfigV1 = selectel.getMksKubeconfigV1({
    clusterId: selectel_mks_cluster_v1.cluster_1.id,
    projectId: selectel_mks_cluster_v1.cluster_1.project_id,
    region: selectel_mks_cluster_v1.cluster_1.region,
});
export const kubeconfig = kubeconfigMksKubeconfigV1.then(kubeconfigMksKubeconfigV1 => kubeconfigMksKubeconfigV1.rawConfig);
Copy
import pulumi
import pulumi_selectel as selectel

kubeconfig_mks_kubeconfig_v1 = selectel.get_mks_kubeconfig_v1(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"])
pulumi.export("kubeconfig", kubeconfig_mks_kubeconfig_v1.raw_config)
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/selectel/v6/selectel"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		kubeconfigMksKubeconfigV1, err := selectel.GetMksKubeconfigV1(ctx, &selectel.GetMksKubeconfigV1Args{
			ClusterId: selectel_mks_cluster_v1.Cluster_1.Id,
			ProjectId: selectel_mks_cluster_v1.Cluster_1.Project_id,
			Region:    selectel_mks_cluster_v1.Cluster_1.Region,
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("kubeconfig", kubeconfigMksKubeconfigV1.RawConfig)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Selectel = Pulumi.Selectel;

return await Deployment.RunAsync(() => 
{
    var kubeconfigMksKubeconfigV1 = Selectel.GetMksKubeconfigV1.Invoke(new()
    {
        ClusterId = selectel_mks_cluster_v1.Cluster_1.Id,
        ProjectId = selectel_mks_cluster_v1.Cluster_1.Project_id,
        Region = selectel_mks_cluster_v1.Cluster_1.Region,
    });

    return new Dictionary<string, object?>
    {
        ["kubeconfig"] = kubeconfigMksKubeconfigV1.Apply(getMksKubeconfigV1Result => getMksKubeconfigV1Result.RawConfig),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.selectel.SelectelFunctions;
import com.pulumi.selectel.inputs.GetMksKubeconfigV1Args;
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 kubeconfigMksKubeconfigV1 = SelectelFunctions.getMksKubeconfigV1(GetMksKubeconfigV1Args.builder()
            .clusterId(selectel_mks_cluster_v1.cluster_1().id())
            .projectId(selectel_mks_cluster_v1.cluster_1().project_id())
            .region(selectel_mks_cluster_v1.cluster_1().region())
            .build());

        ctx.export("kubeconfig", kubeconfigMksKubeconfigV1.applyValue(getMksKubeconfigV1Result -> getMksKubeconfigV1Result.rawConfig()));
    }
}
Copy
variables:
  kubeconfigMksKubeconfigV1:
    fn::invoke:
      function: selectel:getMksKubeconfigV1
      arguments:
        clusterId: ${selectel_mks_cluster_v1.cluster_1.id}
        projectId: ${selectel_mks_cluster_v1.cluster_1.project_id}
        region: ${selectel_mks_cluster_v1.cluster_1.region}
outputs:
  kubeconfig: ${kubeconfigMksKubeconfigV1.rawConfig}
Copy

Using getMksKubeconfigV1

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 getMksKubeconfigV1(args: GetMksKubeconfigV1Args, opts?: InvokeOptions): Promise<GetMksKubeconfigV1Result>
function getMksKubeconfigV1Output(args: GetMksKubeconfigV1OutputArgs, opts?: InvokeOptions): Output<GetMksKubeconfigV1Result>
Copy
def get_mks_kubeconfig_v1(cluster_id: Optional[str] = None,
                          id: Optional[str] = None,
                          project_id: Optional[str] = None,
                          region: Optional[str] = None,
                          opts: Optional[InvokeOptions] = None) -> GetMksKubeconfigV1Result
def get_mks_kubeconfig_v1_output(cluster_id: Optional[pulumi.Input[str]] = None,
                          id: Optional[pulumi.Input[str]] = None,
                          project_id: Optional[pulumi.Input[str]] = None,
                          region: Optional[pulumi.Input[str]] = None,
                          opts: Optional[InvokeOptions] = None) -> Output[GetMksKubeconfigV1Result]
Copy
func GetMksKubeconfigV1(ctx *Context, args *GetMksKubeconfigV1Args, opts ...InvokeOption) (*GetMksKubeconfigV1Result, error)
func GetMksKubeconfigV1Output(ctx *Context, args *GetMksKubeconfigV1OutputArgs, opts ...InvokeOption) GetMksKubeconfigV1ResultOutput
Copy

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

public static class GetMksKubeconfigV1 
{
    public static Task<GetMksKubeconfigV1Result> InvokeAsync(GetMksKubeconfigV1Args args, InvokeOptions? opts = null)
    public static Output<GetMksKubeconfigV1Result> Invoke(GetMksKubeconfigV1InvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetMksKubeconfigV1Result> getMksKubeconfigV1(GetMksKubeconfigV1Args args, InvokeOptions options)
public static Output<GetMksKubeconfigV1Result> getMksKubeconfigV1(GetMksKubeconfigV1Args args, InvokeOptions options)
Copy
fn::invoke:
  function: selectel:index/getMksKubeconfigV1:getMksKubeconfigV1
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

ClusterId This property is required. string
Unique identifier of the cluster.
ProjectId This property is required. string
Unique identifier of the associated project. Retrieved from the selectel.VpcProjectV2 resource. Learn more about Projects.
Region This property is required. string
Pool where the cluster is located, for example, ru-3. Learn more about available pools in the Availability matrix.
Id string
ClusterId This property is required. string
Unique identifier of the cluster.
ProjectId This property is required. string
Unique identifier of the associated project. Retrieved from the selectel.VpcProjectV2 resource. Learn more about Projects.
Region This property is required. string
Pool where the cluster is located, for example, ru-3. Learn more about available pools in the Availability matrix.
Id string
clusterId This property is required. String
Unique identifier of the cluster.
projectId This property is required. String
Unique identifier of the associated project. Retrieved from the selectel.VpcProjectV2 resource. Learn more about Projects.
region This property is required. String
Pool where the cluster is located, for example, ru-3. Learn more about available pools in the Availability matrix.
id String
clusterId This property is required. string
Unique identifier of the cluster.
projectId This property is required. string
Unique identifier of the associated project. Retrieved from the selectel.VpcProjectV2 resource. Learn more about Projects.
region This property is required. string
Pool where the cluster is located, for example, ru-3. Learn more about available pools in the Availability matrix.
id string
cluster_id This property is required. str
Unique identifier of the cluster.
project_id This property is required. str
Unique identifier of the associated project. Retrieved from the selectel.VpcProjectV2 resource. Learn more about Projects.
region This property is required. str
Pool where the cluster is located, for example, ru-3. Learn more about available pools in the Availability matrix.
id str
clusterId This property is required. String
Unique identifier of the cluster.
projectId This property is required. String
Unique identifier of the associated project. Retrieved from the selectel.VpcProjectV2 resource. Learn more about Projects.
region This property is required. String
Pool where the cluster is located, for example, ru-3. Learn more about available pools in the Availability matrix.
id String

getMksKubeconfigV1 Result

The following output properties are available:

ClientCert string
Client certificate for authorization.
ClientKey string
Client key for authorization.
ClusterCaCert string
CA certificate of the cluster.
ClusterId string
Id string
ProjectId string
RawConfig string
Raw content of a kubeconfig file.
Region string
Server string
IP address and port for a Kube API server.
ClientCert string
Client certificate for authorization.
ClientKey string
Client key for authorization.
ClusterCaCert string
CA certificate of the cluster.
ClusterId string
Id string
ProjectId string
RawConfig string
Raw content of a kubeconfig file.
Region string
Server string
IP address and port for a Kube API server.
clientCert String
Client certificate for authorization.
clientKey String
Client key for authorization.
clusterCaCert String
CA certificate of the cluster.
clusterId String
id String
projectId String
rawConfig String
Raw content of a kubeconfig file.
region String
server String
IP address and port for a Kube API server.
clientCert string
Client certificate for authorization.
clientKey string
Client key for authorization.
clusterCaCert string
CA certificate of the cluster.
clusterId string
id string
projectId string
rawConfig string
Raw content of a kubeconfig file.
region string
server string
IP address and port for a Kube API server.
client_cert str
Client certificate for authorization.
client_key str
Client key for authorization.
cluster_ca_cert str
CA certificate of the cluster.
cluster_id str
id str
project_id str
raw_config str
Raw content of a kubeconfig file.
region str
server str
IP address and port for a Kube API server.
clientCert String
Client certificate for authorization.
clientKey String
Client key for authorization.
clusterCaCert String
CA certificate of the cluster.
clusterId String
id String
projectId String
rawConfig String
Raw content of a kubeconfig file.
region String
server String
IP address and port for a Kube API server.

Package Details

Repository
selectel selectel/terraform-provider-selectel
License
Notes
This Pulumi package is based on the selectel Terraform Provider.