volcengine.vke.Kubeconfig
Explore with Pulumi AI
Provides a resource to manage vke kubeconfig
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Volcengine = Pulumi.Volcengine;
return await Deployment.RunAsync(() =>
{
var fooZones = Volcengine.Ecs.Zones.Invoke();
var fooVpc = new Volcengine.Vpc.Vpc("fooVpc", new()
{
VpcName = "acc-test-vpc",
CidrBlock = "172.16.0.0/16",
});
var fooSubnet = new Volcengine.Vpc.Subnet("fooSubnet", new()
{
SubnetName = "acc-test-subnet",
CidrBlock = "172.16.0.0/24",
ZoneId = fooZones.Apply(zonesResult => zonesResult.Zones[0]?.Id),
VpcId = fooVpc.Id,
});
var fooSecurityGroup = new Volcengine.Vpc.SecurityGroup("fooSecurityGroup", new()
{
SecurityGroupName = "acc-test-security-group",
VpcId = fooVpc.Id,
});
var fooCluster = new Volcengine.Vke.Cluster("fooCluster", new()
{
Description = "created by terraform",
DeleteProtectionEnabled = false,
ClusterConfig = new Volcengine.Vke.Inputs.ClusterClusterConfigArgs
{
SubnetIds = new[]
{
fooSubnet.Id,
},
ApiServerPublicAccessEnabled = true,
ApiServerPublicAccessConfig = new Volcengine.Vke.Inputs.ClusterClusterConfigApiServerPublicAccessConfigArgs
{
PublicAccessNetworkConfig = new Volcengine.Vke.Inputs.ClusterClusterConfigApiServerPublicAccessConfigPublicAccessNetworkConfigArgs
{
BillingType = "PostPaidByBandwidth",
Bandwidth = 1,
},
},
ResourcePublicAccessDefaultEnabled = true,
},
PodsConfig = new Volcengine.Vke.Inputs.ClusterPodsConfigArgs
{
PodNetworkMode = "VpcCniShared",
VpcCniConfig = new Volcengine.Vke.Inputs.ClusterPodsConfigVpcCniConfigArgs
{
SubnetIds = new[]
{
fooSubnet.Id,
},
},
},
ServicesConfig = new Volcengine.Vke.Inputs.ClusterServicesConfigArgs
{
ServiceCidrsv4s = new[]
{
"172.30.0.0/18",
},
},
Tags = new[]
{
new Volcengine.Vke.Inputs.ClusterTagArgs
{
Key = "tf-k1",
Value = "tf-v1",
},
},
});
var fooKubeconfig = new Volcengine.Vke.Kubeconfig("fooKubeconfig", new()
{
ClusterId = fooCluster.Id,
Type = "Private",
ValidDuration = 2,
});
});
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/ecs"
"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/vke"
"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/vpc"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
fooZones, err := ecs.Zones(ctx, nil, nil)
if err != nil {
return err
}
fooVpc, err := vpc.NewVpc(ctx, "fooVpc", &vpc.VpcArgs{
VpcName: pulumi.String("acc-test-vpc"),
CidrBlock: pulumi.String("172.16.0.0/16"),
})
if err != nil {
return err
}
fooSubnet, err := vpc.NewSubnet(ctx, "fooSubnet", &vpc.SubnetArgs{
SubnetName: pulumi.String("acc-test-subnet"),
CidrBlock: pulumi.String("172.16.0.0/24"),
ZoneId: *pulumi.String(fooZones.Zones[0].Id),
VpcId: fooVpc.ID(),
})
if err != nil {
return err
}
_, err = vpc.NewSecurityGroup(ctx, "fooSecurityGroup", &vpc.SecurityGroupArgs{
SecurityGroupName: pulumi.String("acc-test-security-group"),
VpcId: fooVpc.ID(),
})
if err != nil {
return err
}
fooCluster, err := vke.NewCluster(ctx, "fooCluster", &vke.ClusterArgs{
Description: pulumi.String("created by terraform"),
DeleteProtectionEnabled: pulumi.Bool(false),
ClusterConfig: &vke.ClusterClusterConfigArgs{
SubnetIds: pulumi.StringArray{
fooSubnet.ID(),
},
ApiServerPublicAccessEnabled: pulumi.Bool(true),
ApiServerPublicAccessConfig: &vke.ClusterClusterConfigApiServerPublicAccessConfigArgs{
PublicAccessNetworkConfig: &vke.ClusterClusterConfigApiServerPublicAccessConfigPublicAccessNetworkConfigArgs{
BillingType: pulumi.String("PostPaidByBandwidth"),
Bandwidth: pulumi.Int(1),
},
},
ResourcePublicAccessDefaultEnabled: pulumi.Bool(true),
},
PodsConfig: &vke.ClusterPodsConfigArgs{
PodNetworkMode: pulumi.String("VpcCniShared"),
VpcCniConfig: &vke.ClusterPodsConfigVpcCniConfigArgs{
SubnetIds: pulumi.StringArray{
fooSubnet.ID(),
},
},
},
ServicesConfig: &vke.ClusterServicesConfigArgs{
ServiceCidrsv4s: pulumi.StringArray{
pulumi.String("172.30.0.0/18"),
},
},
Tags: vke.ClusterTagArray{
&vke.ClusterTagArgs{
Key: pulumi.String("tf-k1"),
Value: pulumi.String("tf-v1"),
},
},
})
if err != nil {
return err
}
_, err = vke.NewKubeconfig(ctx, "fooKubeconfig", &vke.KubeconfigArgs{
ClusterId: fooCluster.ID(),
Type: pulumi.String("Private"),
ValidDuration: pulumi.Int(2),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.volcengine.ecs.EcsFunctions;
import com.pulumi.volcengine.ecs.inputs.ZonesArgs;
import com.pulumi.volcengine.vpc.Vpc;
import com.pulumi.volcengine.vpc.VpcArgs;
import com.pulumi.volcengine.vpc.Subnet;
import com.pulumi.volcengine.vpc.SubnetArgs;
import com.pulumi.volcengine.vpc.SecurityGroup;
import com.pulumi.volcengine.vpc.SecurityGroupArgs;
import com.pulumi.volcengine.vke.Cluster;
import com.pulumi.volcengine.vke.ClusterArgs;
import com.pulumi.volcengine.vke.inputs.ClusterClusterConfigArgs;
import com.pulumi.volcengine.vke.inputs.ClusterClusterConfigApiServerPublicAccessConfigArgs;
import com.pulumi.volcengine.vke.inputs.ClusterClusterConfigApiServerPublicAccessConfigPublicAccessNetworkConfigArgs;
import com.pulumi.volcengine.vke.inputs.ClusterPodsConfigArgs;
import com.pulumi.volcengine.vke.inputs.ClusterPodsConfigVpcCniConfigArgs;
import com.pulumi.volcengine.vke.inputs.ClusterServicesConfigArgs;
import com.pulumi.volcengine.vke.inputs.ClusterTagArgs;
import com.pulumi.volcengine.vke.Kubeconfig;
import com.pulumi.volcengine.vke.KubeconfigArgs;
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 fooZones = EcsFunctions.Zones();
var fooVpc = new Vpc("fooVpc", VpcArgs.builder()
.vpcName("acc-test-vpc")
.cidrBlock("172.16.0.0/16")
.build());
var fooSubnet = new Subnet("fooSubnet", SubnetArgs.builder()
.subnetName("acc-test-subnet")
.cidrBlock("172.16.0.0/24")
.zoneId(fooZones.applyValue(zonesResult -> zonesResult.zones()[0].id()))
.vpcId(fooVpc.id())
.build());
var fooSecurityGroup = new SecurityGroup("fooSecurityGroup", SecurityGroupArgs.builder()
.securityGroupName("acc-test-security-group")
.vpcId(fooVpc.id())
.build());
var fooCluster = new Cluster("fooCluster", ClusterArgs.builder()
.description("created by terraform")
.deleteProtectionEnabled(false)
.clusterConfig(ClusterClusterConfigArgs.builder()
.subnetIds(fooSubnet.id())
.apiServerPublicAccessEnabled(true)
.apiServerPublicAccessConfig(ClusterClusterConfigApiServerPublicAccessConfigArgs.builder()
.publicAccessNetworkConfig(ClusterClusterConfigApiServerPublicAccessConfigPublicAccessNetworkConfigArgs.builder()
.billingType("PostPaidByBandwidth")
.bandwidth(1)
.build())
.build())
.resourcePublicAccessDefaultEnabled(true)
.build())
.podsConfig(ClusterPodsConfigArgs.builder()
.podNetworkMode("VpcCniShared")
.vpcCniConfig(ClusterPodsConfigVpcCniConfigArgs.builder()
.subnetIds(fooSubnet.id())
.build())
.build())
.servicesConfig(ClusterServicesConfigArgs.builder()
.serviceCidrsv4s("172.30.0.0/18")
.build())
.tags(ClusterTagArgs.builder()
.key("tf-k1")
.value("tf-v1")
.build())
.build());
var fooKubeconfig = new Kubeconfig("fooKubeconfig", KubeconfigArgs.builder()
.clusterId(fooCluster.id())
.type("Private")
.validDuration(2)
.build());
}
}
import pulumi
import pulumi_volcengine as volcengine
foo_zones = volcengine.ecs.zones()
foo_vpc = volcengine.vpc.Vpc("fooVpc",
vpc_name="acc-test-vpc",
cidr_block="172.16.0.0/16")
foo_subnet = volcengine.vpc.Subnet("fooSubnet",
subnet_name="acc-test-subnet",
cidr_block="172.16.0.0/24",
zone_id=foo_zones.zones[0].id,
vpc_id=foo_vpc.id)
foo_security_group = volcengine.vpc.SecurityGroup("fooSecurityGroup",
security_group_name="acc-test-security-group",
vpc_id=foo_vpc.id)
foo_cluster = volcengine.vke.Cluster("fooCluster",
description="created by terraform",
delete_protection_enabled=False,
cluster_config=volcengine.vke.ClusterClusterConfigArgs(
subnet_ids=[foo_subnet.id],
api_server_public_access_enabled=True,
api_server_public_access_config=volcengine.vke.ClusterClusterConfigApiServerPublicAccessConfigArgs(
public_access_network_config=volcengine.vke.ClusterClusterConfigApiServerPublicAccessConfigPublicAccessNetworkConfigArgs(
billing_type="PostPaidByBandwidth",
bandwidth=1,
),
),
resource_public_access_default_enabled=True,
),
pods_config=volcengine.vke.ClusterPodsConfigArgs(
pod_network_mode="VpcCniShared",
vpc_cni_config=volcengine.vke.ClusterPodsConfigVpcCniConfigArgs(
subnet_ids=[foo_subnet.id],
),
),
services_config=volcengine.vke.ClusterServicesConfigArgs(
service_cidrsv4s=["172.30.0.0/18"],
),
tags=[volcengine.vke.ClusterTagArgs(
key="tf-k1",
value="tf-v1",
)])
foo_kubeconfig = volcengine.vke.Kubeconfig("fooKubeconfig",
cluster_id=foo_cluster.id,
type="Private",
valid_duration=2)
import * as pulumi from "@pulumi/pulumi";
import * as volcengine from "@pulumi/volcengine";
import * as volcengine from "@volcengine/pulumi";
const fooZones = volcengine.ecs.Zones({});
const fooVpc = new volcengine.vpc.Vpc("fooVpc", {
vpcName: "acc-test-vpc",
cidrBlock: "172.16.0.0/16",
});
const fooSubnet = new volcengine.vpc.Subnet("fooSubnet", {
subnetName: "acc-test-subnet",
cidrBlock: "172.16.0.0/24",
zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
vpcId: fooVpc.id,
});
const fooSecurityGroup = new volcengine.vpc.SecurityGroup("fooSecurityGroup", {
securityGroupName: "acc-test-security-group",
vpcId: fooVpc.id,
});
const fooCluster = new volcengine.vke.Cluster("fooCluster", {
description: "created by terraform",
deleteProtectionEnabled: false,
clusterConfig: {
subnetIds: [fooSubnet.id],
apiServerPublicAccessEnabled: true,
apiServerPublicAccessConfig: {
publicAccessNetworkConfig: {
billingType: "PostPaidByBandwidth",
bandwidth: 1,
},
},
resourcePublicAccessDefaultEnabled: true,
},
podsConfig: {
podNetworkMode: "VpcCniShared",
vpcCniConfig: {
subnetIds: [fooSubnet.id],
},
},
servicesConfig: {
serviceCidrsv4s: ["172.30.0.0/18"],
},
tags: [{
key: "tf-k1",
value: "tf-v1",
}],
});
const fooKubeconfig = new volcengine.vke.Kubeconfig("fooKubeconfig", {
clusterId: fooCluster.id,
type: "Private",
validDuration: 2,
});
resources:
fooVpc:
type: volcengine:vpc:Vpc
properties:
vpcName: acc-test-vpc
cidrBlock: 172.16.0.0/16
fooSubnet:
type: volcengine:vpc:Subnet
properties:
subnetName: acc-test-subnet
cidrBlock: 172.16.0.0/24
zoneId: ${fooZones.zones[0].id}
vpcId: ${fooVpc.id}
fooSecurityGroup:
type: volcengine:vpc:SecurityGroup
properties:
securityGroupName: acc-test-security-group
vpcId: ${fooVpc.id}
fooCluster:
type: volcengine:vke:Cluster
properties:
description: created by terraform
deleteProtectionEnabled: false
clusterConfig:
subnetIds:
- ${fooSubnet.id}
apiServerPublicAccessEnabled: true
apiServerPublicAccessConfig:
publicAccessNetworkConfig:
billingType: PostPaidByBandwidth
bandwidth: 1
resourcePublicAccessDefaultEnabled: true
podsConfig:
podNetworkMode: VpcCniShared
vpcCniConfig:
subnetIds:
- ${fooSubnet.id}
servicesConfig:
serviceCidrsv4s:
- 172.30.0.0/18
tags:
- key: tf-k1
value: tf-v1
fooKubeconfig:
type: volcengine:vke:Kubeconfig
properties:
clusterId: ${fooCluster.id}
type: Private
validDuration: 2
variables:
fooZones:
fn::invoke:
Function: volcengine:ecs:Zones
Arguments: {}
Create Kubeconfig Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Kubeconfig(name: string, args: KubeconfigArgs, opts?: CustomResourceOptions);
@overload
def Kubeconfig(resource_name: str,
args: KubeconfigArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Kubeconfig(resource_name: str,
opts: Optional[ResourceOptions] = None,
cluster_id: Optional[str] = None,
type: Optional[str] = None,
valid_duration: Optional[int] = None)
func NewKubeconfig(ctx *Context, name string, args KubeconfigArgs, opts ...ResourceOption) (*Kubeconfig, error)
public Kubeconfig(string name, KubeconfigArgs args, CustomResourceOptions? opts = null)
public Kubeconfig(String name, KubeconfigArgs args)
public Kubeconfig(String name, KubeconfigArgs args, CustomResourceOptions options)
type: volcengine:vke:Kubeconfig
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args KubeconfigArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args KubeconfigArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args KubeconfigArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args KubeconfigArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args KubeconfigArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var kubeconfigResource = new Volcengine.Vke.Kubeconfig("kubeconfigResource", new()
{
ClusterId = "string",
Type = "string",
ValidDuration = 0,
});
example, err := vke.NewKubeconfig(ctx, "kubeconfigResource", &vke.KubeconfigArgs{
ClusterId: pulumi.String("string"),
Type: pulumi.String("string"),
ValidDuration: pulumi.Int(0),
})
var kubeconfigResource = new Kubeconfig("kubeconfigResource", KubeconfigArgs.builder()
.clusterId("string")
.type("string")
.validDuration(0)
.build());
kubeconfig_resource = volcengine.vke.Kubeconfig("kubeconfigResource",
cluster_id="string",
type="string",
valid_duration=0)
const kubeconfigResource = new volcengine.vke.Kubeconfig("kubeconfigResource", {
clusterId: "string",
type: "string",
validDuration: 0,
});
type: volcengine:vke:Kubeconfig
properties:
clusterId: string
type: string
validDuration: 0
Kubeconfig Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Kubeconfig resource accepts the following input properties:
- Cluster
Id string - The cluster id of the Kubeconfig.
- Type string
- The type of the Kubeconfig, the value of type should be Public or Private.
- Valid
Duration int - The ValidDuration of the Kubeconfig, the range of the ValidDuration is 1 hour to 43800 hour.
- Cluster
Id string - The cluster id of the Kubeconfig.
- Type string
- The type of the Kubeconfig, the value of type should be Public or Private.
- Valid
Duration int - The ValidDuration of the Kubeconfig, the range of the ValidDuration is 1 hour to 43800 hour.
- cluster
Id String - The cluster id of the Kubeconfig.
- type String
- The type of the Kubeconfig, the value of type should be Public or Private.
- valid
Duration Integer - The ValidDuration of the Kubeconfig, the range of the ValidDuration is 1 hour to 43800 hour.
- cluster
Id string - The cluster id of the Kubeconfig.
- type string
- The type of the Kubeconfig, the value of type should be Public or Private.
- valid
Duration number - The ValidDuration of the Kubeconfig, the range of the ValidDuration is 1 hour to 43800 hour.
- cluster_
id str - The cluster id of the Kubeconfig.
- type str
- The type of the Kubeconfig, the value of type should be Public or Private.
- valid_
duration int - The ValidDuration of the Kubeconfig, the range of the ValidDuration is 1 hour to 43800 hour.
- cluster
Id String - The cluster id of the Kubeconfig.
- type String
- The type of the Kubeconfig, the value of type should be Public or Private.
- valid
Duration Number - The ValidDuration of the Kubeconfig, the range of the ValidDuration is 1 hour to 43800 hour.
Outputs
All input properties are implicitly available as output properties. Additionally, the Kubeconfig resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing Kubeconfig Resource
Get an existing Kubeconfig resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: KubeconfigState, opts?: CustomResourceOptions): Kubeconfig
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
cluster_id: Optional[str] = None,
type: Optional[str] = None,
valid_duration: Optional[int] = None) -> Kubeconfig
func GetKubeconfig(ctx *Context, name string, id IDInput, state *KubeconfigState, opts ...ResourceOption) (*Kubeconfig, error)
public static Kubeconfig Get(string name, Input<string> id, KubeconfigState? state, CustomResourceOptions? opts = null)
public static Kubeconfig get(String name, Output<String> id, KubeconfigState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Cluster
Id string - The cluster id of the Kubeconfig.
- Type string
- The type of the Kubeconfig, the value of type should be Public or Private.
- Valid
Duration int - The ValidDuration of the Kubeconfig, the range of the ValidDuration is 1 hour to 43800 hour.
- Cluster
Id string - The cluster id of the Kubeconfig.
- Type string
- The type of the Kubeconfig, the value of type should be Public or Private.
- Valid
Duration int - The ValidDuration of the Kubeconfig, the range of the ValidDuration is 1 hour to 43800 hour.
- cluster
Id String - The cluster id of the Kubeconfig.
- type String
- The type of the Kubeconfig, the value of type should be Public or Private.
- valid
Duration Integer - The ValidDuration of the Kubeconfig, the range of the ValidDuration is 1 hour to 43800 hour.
- cluster
Id string - The cluster id of the Kubeconfig.
- type string
- The type of the Kubeconfig, the value of type should be Public or Private.
- valid
Duration number - The ValidDuration of the Kubeconfig, the range of the ValidDuration is 1 hour to 43800 hour.
- cluster_
id str - The cluster id of the Kubeconfig.
- type str
- The type of the Kubeconfig, the value of type should be Public or Private.
- valid_
duration int - The ValidDuration of the Kubeconfig, the range of the ValidDuration is 1 hour to 43800 hour.
- cluster
Id String - The cluster id of the Kubeconfig.
- type String
- The type of the Kubeconfig, the value of type should be Public or Private.
- valid
Duration Number - The ValidDuration of the Kubeconfig, the range of the ValidDuration is 1 hour to 43800 hour.
Import
VkeKubeconfig can be imported using the id, e.g.
$ pulumi import volcengine:vke/kubeconfig:Kubeconfig default kce8simvqtofl0l6u4qd0
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- volcengine volcengine/pulumi-volcengine
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
volcengine
Terraform Provider.