ServerlessKubernetesArgs

data class ServerlessKubernetesArgs(val addons: Output<List<ServerlessKubernetesAddonArgs>>? = null, val clientCert: Output<String>? = null, val clientKey: Output<String>? = null, val clusterCaCert: Output<String>? = null, val clusterSpec: Output<String>? = null, val customSan: Output<String>? = null, val deleteOptions: Output<List<ServerlessKubernetesDeleteOptionArgs>>? = null, val deletionProtection: Output<Boolean>? = null, val enableRrsa: Output<Boolean>? = null, val endpointPublicAccessEnabled: Output<Boolean>? = null, val kubeConfig: Output<String>? = null, val loadBalancerSpec: Output<String>? = null, val loggingType: Output<String>? = null, val maintenanceWindow: Output<ServerlessKubernetesMaintenanceWindowArgs>? = null, val name: Output<String>? = null, val namePrefix: Output<String>? = null, val newNatGateway: Output<Boolean>? = null, val operationPolicy: Output<ServerlessKubernetesOperationPolicyArgs>? = null, val privateZone: Output<Boolean>? = null, val resourceGroupId: Output<String>? = null, val retainResources: Output<List<String>>? = null, val securityGroupId: Output<String>? = null, val serviceCidr: Output<String>? = null, val serviceDiscoveryTypes: Output<List<String>>? = null, val slsProjectName: Output<String>? = null, val tags: Output<Map<String, String>>? = null, val timeZone: Output<String>? = null, val version: Output<String>? = null, val vpcId: Output<String>? = null, val vswitchIds: Output<List<String>>? = null, val zoneId: Output<String>? = null) : ConvertibleToJava<ServerlessKubernetesArgs>

This resource will help you to manager a Serverless Kubernetes Cluster, see What is serverless kubernetes. The cluster is same as container service created by web console.

NOTE: Available since v1.58.0. NOTE: Serverless Kubernetes cluster only supports VPC network and it can access internet while creating kubernetes cluster. A Nat Gateway and configuring a SNAT for it can ensure one VPC network access internet. If there is no nat gateway in the VPC, you can set new_nat_gateway to "true" to create one automatically. NOTE: Creating serverless kubernetes cluster need to install several packages and it will cost about 5 minutes. Please be patient. NOTE: The provider supports to download kube config, client certificate, client key and cluster ca certificate after creating cluster successfully, and you can put them into the specified location, like '~/.kube/config'. NOTE: If you want to manage serverless Kubernetes, you can use Kubernetes Provider. NOTE: You need to activate several other products and confirm Authorization Policy used by Container Service before using this resource. Please refer to the Authorization management and Cluster management sections in the Document Center. NOTE: From version 1.162.0, support for creating professional serverless cluster. NOTE: From version 1.229.1, support to migrate basic serverless cluster to professional serverless cluster.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "ask-example-pro";
const _default = alicloud.getZones({
availableResourceCreation: "VSwitch",
});
const defaultNetwork = new alicloud.vpc.Network("default", {
vpcName: name,
cidrBlock: "10.2.0.0/21",
});
const defaultSwitch = new alicloud.vpc.Switch("default", {
vswitchName: name,
vpcId: defaultNetwork.id,
cidrBlock: "10.2.1.0/24",
zoneId: _default.then(_default => _default.zones?.[0]?.id),
});
const serverless = new alicloud.cs.ServerlessKubernetes("serverless", {
namePrefix: name,
clusterSpec: "ack.pro.small",
vpcId: defaultNetwork.id,
vswitchIds: [defaultSwitch&#46;id],
newNatGateway: true,
endpointPublicAccessEnabled: true,
deletionProtection: false,
timeZone: "Asia/Shanghai",
serviceCidr: "172.21.0.0/20",
tags: {
"k-aa": "v-aa",
"k-bb": "v-bb",
},
});
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "ask-example-pro"
default = alicloud.get_zones(available_resource_creation="VSwitch")
default_network = alicloud.vpc.Network("default",
vpc_name=name,
cidr_block="10.2.0.0/21")
default_switch = alicloud.vpc.Switch("default",
vswitch_name=name,
vpc_id=default_network.id,
cidr_block="10.2.1.0/24",
zone_id=default.zones[0].id)
serverless = alicloud.cs.ServerlessKubernetes("serverless",
name_prefix=name,
cluster_spec="ack.pro.small",
vpc_id=default_network.id,
vswitch_ids=[default_switch&#46;id],
new_nat_gateway=True,
endpoint_public_access_enabled=True,
deletion_protection=False,
time_zone="Asia/Shanghai",
service_cidr="172.21.0.0/20",
tags={
"k-aa": "v-aa",
"k-bb": "v-bb",
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "ask-example-pro";
var @default = AliCloud.GetZones.Invoke(new()
{
AvailableResourceCreation = "VSwitch",
});
var defaultNetwork = new AliCloud.Vpc.Network("default", new()
{
VpcName = name,
CidrBlock = "10.2.0.0/21",
});
var defaultSwitch = new AliCloud.Vpc.Switch("default", new()
{
VswitchName = name,
VpcId = defaultNetwork.Id,
CidrBlock = "10.2.1.0/24",
ZoneId = @default.Apply(@default => @default.Apply(getZonesResult => getZonesResult.Zones[0]?.Id)),
});
var serverless = new AliCloud.CS.ServerlessKubernetes("serverless", new()
{
NamePrefix = name,
ClusterSpec = "ack.pro.small",
VpcId = defaultNetwork.Id,
VswitchIds = new[]
{
defaultSwitch.Id,
},
NewNatGateway = true,
EndpointPublicAccessEnabled = true,
DeletionProtection = false,
TimeZone = "Asia/Shanghai",
ServiceCidr = "172.21.0.0/20",
Tags =
{
{ "k-aa", "v-aa" },
{ "k-bb", "v-bb" },
},
});
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cs"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "ask-example-pro"
if param := cfg.Get("name"); param != "" {
name = param
}
_default, err := alicloud.GetZones(ctx, &alicloud.GetZonesArgs{
AvailableResourceCreation: pulumi.StringRef("VSwitch"),
}, nil)
if err != nil {
return err
}
defaultNetwork, err := vpc.NewNetwork(ctx, "default", &vpc.NetworkArgs{
VpcName: pulumi.String(name),
CidrBlock: pulumi.String("10.2.0.0/21"),
})
if err != nil {
return err
}
defaultSwitch, err := vpc.NewSwitch(ctx, "default", &vpc.SwitchArgs{
VswitchName: pulumi.String(name),
VpcId: defaultNetwork.ID(),
CidrBlock: pulumi.String("10.2.1.0/24"),
ZoneId: pulumi.String(_default.Zones[0].Id),
})
if err != nil {
return err
}
_, err = cs.NewServerlessKubernetes(ctx, "serverless", &cs.ServerlessKubernetesArgs{
NamePrefix: pulumi.String(name),
ClusterSpec: pulumi.String("ack.pro.small"),
VpcId: defaultNetwork.ID(),
VswitchIds: pulumi.StringArray{
defaultSwitch.ID(),
},
NewNatGateway: pulumi.Bool(true),
EndpointPublicAccessEnabled: pulumi.Bool(true),
DeletionProtection: pulumi.Bool(false),
TimeZone: pulumi.String("Asia/Shanghai"),
ServiceCidr: pulumi.String("172.21.0.0/20"),
Tags: pulumi.StringMap{
"k-aa": pulumi.String("v-aa"),
"k-bb": pulumi.String("v-bb"),
},
})
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.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.inputs.GetZonesArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.alicloud.cs.ServerlessKubernetes;
import com.pulumi.alicloud.cs.ServerlessKubernetesArgs;
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 config = ctx.config();
final var name = config.get("name").orElse("ask-example-pro");
final var default = AlicloudFunctions.getZones(GetZonesArgs.builder()
.availableResourceCreation("VSwitch")
.build());
var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
.vpcName(name)
.cidrBlock("10.2.0.0/21")
.build());
var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
.vswitchName(name)
.vpcId(defaultNetwork.id())
.cidrBlock("10.2.1.0/24")
.zoneId(default_.zones()[0].id())
.build());
var serverless = new ServerlessKubernetes("serverless", ServerlessKubernetesArgs.builder()
.namePrefix(name)
.clusterSpec("ack.pro.small")
.vpcId(defaultNetwork.id())
.vswitchIds(defaultSwitch.id())
.newNatGateway(true)
.endpointPublicAccessEnabled(true)
.deletionProtection(false)
.timeZone("Asia/Shanghai")
.serviceCidr("172.21.0.0/20")
.tags(Map.ofEntries(
Map.entry("k-aa", "v-aa"),
Map.entry("k-bb", "v-bb")
))
.build());
}
}
configuration:
name:
type: string
default: ask-example-pro
resources:
defaultNetwork:
type: alicloud:vpc:Network
name: default
properties:
vpcName: ${name}
cidrBlock: 10.2.0.0/21
defaultSwitch:
type: alicloud:vpc:Switch
name: default
properties:
vswitchName: ${name}
vpcId: ${defaultNetwork.id}
cidrBlock: 10.2.1.0/24
zoneId: ${default.zones[0].id}
serverless:
type: alicloud:cs:ServerlessKubernetes
properties:
namePrefix: ${name}
clusterSpec: ack.pro.small
vpcId: ${defaultNetwork.id}
vswitchIds:
- ${defaultSwitch.id}
newNatGateway: true
endpointPublicAccessEnabled: true
deletionProtection: false
timeZone: Asia/Shanghai
serviceCidr: 172.21.0.0/20
tags:
k-aa: v-aa
k-bb: v-bb
variables:
default:
fn::invoke:
function: alicloud:getZones
arguments:
availableResourceCreation: VSwitch

Import

Serverless Kubernetes cluster can be imported using the id, e.g. Then complete the main.tf accords to the result of pulumi preview.

$ pulumi import alicloud:cs/serverlessKubernetes:ServerlessKubernetes main ce4273f9156874b46bb

Constructors

Link copied to clipboard
constructor(addons: Output<List<ServerlessKubernetesAddonArgs>>? = null, clientCert: Output<String>? = null, clientKey: Output<String>? = null, clusterCaCert: Output<String>? = null, clusterSpec: Output<String>? = null, customSan: Output<String>? = null, deleteOptions: Output<List<ServerlessKubernetesDeleteOptionArgs>>? = null, deletionProtection: Output<Boolean>? = null, enableRrsa: Output<Boolean>? = null, endpointPublicAccessEnabled: Output<Boolean>? = null, kubeConfig: Output<String>? = null, loadBalancerSpec: Output<String>? = null, loggingType: Output<String>? = null, maintenanceWindow: Output<ServerlessKubernetesMaintenanceWindowArgs>? = null, name: Output<String>? = null, namePrefix: Output<String>? = null, newNatGateway: Output<Boolean>? = null, operationPolicy: Output<ServerlessKubernetesOperationPolicyArgs>? = null, privateZone: Output<Boolean>? = null, resourceGroupId: Output<String>? = null, retainResources: Output<List<String>>? = null, securityGroupId: Output<String>? = null, serviceCidr: Output<String>? = null, serviceDiscoveryTypes: Output<List<String>>? = null, slsProjectName: Output<String>? = null, tags: Output<Map<String, String>>? = null, timeZone: Output<String>? = null, version: Output<String>? = null, vpcId: Output<String>? = null, vswitchIds: Output<List<String>>? = null, zoneId: Output<String>? = null)

Properties

Link copied to clipboard

You can specific network plugin, log component, ingress component and so on. See addons below. Only works for Create Operation, use resource cs_kubernetes_addon to manage addons if cluster is created.

Link copied to clipboard
val clientCert: Output<String>? = null

From version 1.248.0, new DataSource alicloud.cs.getClusterCredential is recommended to manage cluster's kubeconfig, you can also save the certificate_authority.client_cert attribute content of new DataSource alicloud.cs.getClusterCredential to an appropriate path(like ~/.kube/client-cert.pem) for replace it.

Link copied to clipboard
val clientKey: Output<String>? = null

From version 1.248.0, new DataSource alicloud.cs.getClusterCredential is recommended to manage cluster's kubeconfig, you can also save the certificate_authority.client_key attribute content of new DataSource alicloud.cs.getClusterCredential to an appropriate path(like ~/.kube/client-key.pem) for replace it.

Link copied to clipboard
val clusterCaCert: Output<String>? = null

From version 1.248.0, new DataSource alicloud.cs.getClusterCredential is recommended to manage cluster's kubeconfig, you can also save the certificate_authority.cluster_cert attribute content of new DataSource alicloud.cs.getClusterCredential to an appropriate path(like ~/.kube/cluster-ca-cert.pem) for replace it.

Link copied to clipboard
val clusterSpec: Output<String>? = null

The cluster specifications of serverless kubernetes cluster, which can be empty. Valid values:

Link copied to clipboard
val customSan: Output<String>? = null

Customize the certificate SAN, multiple IP or domain names are separated by English commas (,).

Link copied to clipboard

Delete options, only work for deleting resource. Make sure you have run pulumi up to make the configuration applied. See delete_options below.

Link copied to clipboard
val deletionProtection: Output<Boolean>? = null

Whether enable the deletion protection or not.

Link copied to clipboard
val enableRrsa: Output<Boolean>? = null

Whether to enable cluster to support RRSA for version 1.22.3+. Default to false. Once the RRSA function is turned on, it is not allowed to turn off. If your cluster has enabled this function, please manually modify your tf file and add the rrsa configuration to the file, learn more RAM Roles for Service Accounts.

Link copied to clipboard

Whether to create internet eip for API Server. Default to false. Only works for Create Operation.

Link copied to clipboard
val kubeConfig: Output<String>? = null

The path of kube config, like ~/.kube/config. Please use the attribute output_file of new DataSource alicloud.cs.getClusterCredential to replace it.

Link copied to clipboard
val loadBalancerSpec: Output<String>? = null

The cluster api server load balance instance specification, default slb.s2.small. For more information on how to select a LB instance specification, see SLB instance overview. Only works for Create Operation.

Link copied to clipboard
val loggingType: Output<String>? = null

Enable log service, Valid value SLS. Only works for Create Operation.

Link copied to clipboard

The cluster maintenance window,effective only in the professional managed cluster. Managed node pool will use it. See maintenance_window below.

Link copied to clipboard
val name: Output<String>? = null

The kubernetes cluster's name. It is the only in one Alicloud account.

Link copied to clipboard
val namePrefix: Output<String>? = null
Link copied to clipboard
val newNatGateway: Output<Boolean>? = null

Whether to create a new nat gateway while creating kubernetes cluster. SNAT must be configured when a new VPC is automatically created. Default is true.

Link copied to clipboard

The cluster automatic operation policy. See operation_policy below. Removed params

Link copied to clipboard
val privateZone: Output<Boolean>? = null

Has been deprecated from provider version 1.123.1. PrivateZone is used as the enumeration value of service_discovery_types.

Link copied to clipboard
val resourceGroupId: Output<String>? = null

The ID of the resource group,by default these cloud resources are automatically assigned to the default resource group.

Link copied to clipboard
val retainResources: Output<List<String>>? = null
Link copied to clipboard
val securityGroupId: Output<String>? = null

The ID of the security group to which the ECS instances in the cluster belong. If it is not specified, a new Security group will be built.

Link copied to clipboard
val serviceCidr: Output<String>? = null

CIDR block of the service network. The specified CIDR block cannot overlap with that of the VPC or those of the ACK clusters that are deployed in the VPC. The CIDR block cannot be modified after the cluster is created.

Link copied to clipboard
val serviceDiscoveryTypes: Output<List<String>>? = null

Service discovery type. Only works for Create Operation. If the value is empty, it means that service discovery is not enabled. Valid values are CoreDNS and PrivateZone.

Link copied to clipboard
val slsProjectName: Output<String>? = null

If you use an existing SLS project, you must specify sls_project_name. Only works for Create Operation.

Link copied to clipboard
val tags: Output<Map<String, String>>? = null

Default nil, A map of tags assigned to the kubernetes cluster and work nodes.

Link copied to clipboard
val timeZone: Output<String>? = null

The time zone of the cluster.

Link copied to clipboard
val version: Output<String>? = null

Desired Kubernetes version. If you do not specify a value, the latest available version at resource creation is used. Do not specify if cluster auto upgrade is enabled, see cluster_auto_upgrade for more information.

Link copied to clipboard
val vpcId: Output<String>? = null

The vpc where new kubernetes cluster will be located. Specify one vpc's id, if it is not specified, a new VPC will be built.

Link copied to clipboard
val vswitchIds: Output<List<String>>? = null

The vswitches where new kubernetes cluster will be located.

Link copied to clipboard
val zoneId: Output<String>? = null

When creating a cluster using automatic VPC creation, you need to specify the zone where the VPC is located. Only works for Create Operation.

Functions

Link copied to clipboard
open override fun toJava(): ServerlessKubernetesArgs