ServerlessKubernetes

class ServerlessKubernetes : KotlinCustomResource

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.

Example Usage

Basic Usage

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 com.pulumi.alicloud.cs.inputs.ServerlessKubernetesAddonArgs;
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");
final var defaultZones = AlicloudFunctions.getZones(GetZonesArgs.builder()
.availableResourceCreation("VSwitch")
.build());
var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
.vpcName(name)
.cidrBlock("10.1.0.0/21")
.build());
var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
.vswitchName(name)
.vpcId(defaultNetwork.id())
.cidrBlock("10.1.1.0/24")
.zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.build());
var serverless = new ServerlessKubernetes("serverless", ServerlessKubernetesArgs.builder()
.namePrefix(name)
.vpcId(defaultNetwork.id())
.vswitchIds(defaultSwitch.id())
.newNatGateway(true)
.endpointPublicAccessEnabled(true)
.deletionProtection(false)
.loadBalancerSpec("slb.s2.small")
.timeZone("Asia/Shanghai")
.serviceCidr("172.21.0.0/20")
.serviceDiscoveryTypes("PrivateZone")
.loggingType("SLS")
.tags(Map.ofEntries(
Map.entry("k-aa", "v-aa"),
Map.entry("k-bb", "v-aa")
))
.addons(
ServerlessKubernetesAddonArgs.builder()
.name("alb-ingress-controller")
.build(),
ServerlessKubernetesAddonArgs.builder()
.name("metrics-server")
.build(),
ServerlessKubernetesAddonArgs.builder()
.name("knative")
.build())
.build());
}
}

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

Properties

Link copied to clipboard

You can specific network plugin,log component,ingress component and so on. See addons below.

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

The path of client certificate, like ~/.kube/client-cert.pem.

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

The path of client key, like ~/.kube/client-key.pem.

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

The path of cluster ca certificate, like ~/.kube/cluster-ca-cert.pem

Link copied to clipboard
val clusterSpec: Output<String>

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

Link copied to clipboard

whether to create a v2 version cluster. Removed params

Link copied to clipboard

Whether enable the deletion protection or not.

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

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.

Link copied to clipboard
val forceUpdate: Output<Boolean>?

Default false, when you want to change vpc_id and vswitch_id, you have to set this field to true, then the cluster will be recreated.

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

The path of kube config, like ~/.kube/config.

Link copied to clipboard

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.

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

Enable log service, Valid value SLS.

Link copied to clipboard
val name: Output<String>

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

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

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
val privateZone: Output<Boolean>?

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 pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val resourceGroupId: Output<String>

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>>?
Link copied to clipboard

Nested attribute containing RRSA related data for your cluster. See rrsa_metadata below.

Link copied to clipboard
val securityGroupId: Output<String>

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>?

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

Service discovery type. 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>

If you use an existing SLS project, you must specify sls_project_name.

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

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

Link copied to clipboard
val timeZone: Output<String>

The time zone of the cluster.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val version: Output<String>

Desired Kubernetes version. If you do not specify a value, the latest available version at resource creation is used.

Link copied to clipboard
val vpcId: Output<String>

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 vswitchId: Output<String>

The vswitch where new kubernetes cluster will be located. Specify one vswitch's id, if it is not specified, a new VPC and VSwicth will be built. It must be in the zone which availability_zone specified.

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

The vswitches where new kubernetes cluster will be located.

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

When creating a cluster using automatic VPC creation, you need to specify the zone where the VPC is located.