Edge Kubernetes Args
This resource will help you to manage a Edge Kubernetes Cluster in Alibaba Cloud Kubernetes Service, see What is edge kubernetes.
NOTE: 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 kubernetes cluster need to install several packages and it will cost about 15 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: The provider supports disabling internet load balancer for API Server by settingfalse
toslb_internet_enabled
. NOTE: If you want to manage Kubernetes, you can use Kubernetes Provider. NOTE: Available since v1.103.0. NOTE: From version 1.185.0+, support new fieldscluster_spec
,runtime
andload_balancer_spec
.
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.ecs.EcsFunctions;
import com.pulumi.alicloud.ecs.inputs.GetInstanceTypesArgs;
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.EdgeKubernetes;
import com.pulumi.alicloud.cs.EdgeKubernetesArgs;
import com.pulumi.alicloud.cs.inputs.EdgeKubernetesWorkerDataDiskArgs;
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("tf-example");
final var defaultZones = AlicloudFunctions.getZones(GetZonesArgs.builder()
.availableResourceCreation("VSwitch")
.build());
final var defaultInstanceTypes = EcsFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
.availabilityZone(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.cpuCoreCount(4)
.memorySize(8)
.kubernetesNodeRole("Master")
.build());
var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
.vpcName(name)
.cidrBlock("10.4.0.0/16")
.build());
var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
.vswitchName(name)
.cidrBlock("10.4.0.0/24")
.vpcId(defaultNetwork.id())
.zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.build());
var defaultEdgeKubernetes = new EdgeKubernetes("defaultEdgeKubernetes", EdgeKubernetesArgs.builder()
.workerVswitchIds(defaultSwitch.id())
.workerInstanceTypes(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.instanceTypes()[0].id()))
.version("1.20.11-aliyunedge.1")
.workerNumber("1")
.password("Test12345")
.podCidr("10.99.0.0/16")
.serviceCidr("172.16.0.0/16")
.workerInstanceChargeType("PostPaid")
.newNatGateway("true")
.nodeCidrMask("24")
.installCloudMonitor("true")
.slbInternetEnabled("true")
.isEnterpriseSecurityGroup("true")
.workerDataDisks(EdgeKubernetesWorkerDataDiskArgs.builder()
.category("cloud_ssd")
.size("200")
.encrypted("false")
.build())
.build());
}
}
Import
Kubernetes edge 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/edgeKubernetes:EdgeKubernetes main cluster-id
Constructors
Functions
Properties
Enable to create advanced security group. default: false. See Advanced security group.
The cluster api server load balance instance specification. For more information on how to select a LB instance specification, see SLB instance overview. ->NOTE: If you want to use Flannel
as CNI network plugin, You need to specific the pod_cidr
field and addons with flannel
. Worker params
The runtime of containers. If you select another container runtime, see Comparison of Docker, containerd, and Sandboxed-Container. Detailed below.
Desired Kubernetes version. If you do not specify a value, the latest available version at resource creation is used and no upgrades will occur except you set a higher version number. The value must be configured and increased to upgrade the version when desired. Downgrades are not supported by ACK.
Worker node system disk performance level, when worker_disk_category
values cloud_essd
, the optional values are PL0
, PL1
, PL2
or PL3
, but the specific performance level is related to the disk capacity. For more information, see Enhanced SSDs. Default is PL1
.
Worker node system disk auto snapshot policy. Computed params You can set some file paths to save kube_config information, but this way is cumbersome. Since version 1.105.0, we've written it to tf state file. About its use,see export attribute certificate_authority. From version 1.187.0+, new DataSource alicloud.cs.getClusterCredential
is recommended to manage cluster's kube_config.
Worker payment type, its valid value is PostPaid
. Defaults to PostPaid
. More charge details in ACK@edge charge.