1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. cs
  5. KubernetesAutoscaler
Viewing docs for Alibaba Cloud v3.97.0
published on Saturday, Mar 14, 2026 by Pulumi
alicloud logo
Viewing docs for Alibaba Cloud v3.97.0
published on Saturday, Mar 14, 2026 by Pulumi

    This resource will help you to manager cluster-autoscaler in Kubernetes Cluster.

    NOTE: The scaling group must use CentOS7 or AliyunLinux2 as base image.

    NOTE: The cluster-autoscaler can only use the same size of instanceTypes in one scaling group.

    NOTE: Add Policy to RAM role of the node to deploy cluster-autoscaler if you need.

    NOTE: Available since v1.65.0.

    DEPRECATED: This resource has been deprecated from version 1.127.0. Please use new resource alicloud_cs_autoscaling_config. If you have used resource alicloud.cs.KubernetesAutoscaler, please refer to Use Terraform to create an auto-scaling node pool to switch to alicloud.cs.AutoscalingConfig.

    Example Usage

    cluster-autoscaler in Kubernetes Cluster.

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    import * as std from "@pulumi/std";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "tf-example";
    const _default = alicloud.getZones({
        availableResourceCreation: "VSwitch",
    });
    const defaultGetImages = alicloud.ecs.getImages({
        nameRegex: "^ubuntu_18.*64",
        mostRecent: true,
        owners: "system",
    });
    const defaultGetInstanceTypes = _default.then(_default => alicloud.ecs.getInstanceTypes({
        availabilityZone: _default.zones?.[0]?.id,
        cpuCoreCount: 4,
        memorySize: 8,
        kubernetesNodeRole: "Worker",
    }));
    const defaultNetwork = new alicloud.vpc.Network("default", {
        vpcName: name,
        cidrBlock: "10.4.0.0/16",
    });
    const defaultSwitch = new alicloud.vpc.Switch("default", {
        vswitchName: name,
        cidrBlock: "10.4.0.0/24",
        vpcId: defaultNetwork.id,
        zoneId: _default.then(_default => _default.zones?.[0]?.id),
    });
    const defaultManagedKubernetes = new alicloud.cs.ManagedKubernetes("default", {
        namePrefix: name,
        clusterSpec: "ack.pro.small",
        workerVswitchIds: [defaultSwitch.id],
        newNatGateway: true,
        podCidr: std.cidrsubnet({
            input: "10.0.0.0/8",
            newbits: 8,
            netnum: 36,
        }).then(invoke => invoke.result),
        serviceCidr: std.cidrsubnet({
            input: "172.16.0.0/16",
            newbits: 4,
            netnum: 7,
        }).then(invoke => invoke.result),
        slbInternetEnabled: true,
    });
    const defaultSecurityGroup = new alicloud.ecs.SecurityGroup("default", {
        name: name,
        vpcId: defaultNetwork.id,
    });
    const defaultScalingGroup = new alicloud.ess.ScalingGroup("default", {
        scalingGroupName: name,
        minSize: 1,
        maxSize: 1,
        vswitchIds: [defaultSwitch.id],
        removalPolicies: [
            "OldestInstance",
            "NewestInstance",
        ],
    });
    const defaultScalingConfiguration = new alicloud.ess.ScalingConfiguration("default", {
        scalingGroupId: defaultScalingGroup.id,
        imageId: defaultGetImages.then(defaultGetImages => defaultGetImages.images?.[0]?.id),
        instanceType: defaultGetInstanceTypes.then(defaultGetInstanceTypes => defaultGetInstanceTypes.instanceTypes?.[0]?.id),
        securityGroupId: defaultSecurityGroup.id,
        forceDelete: true,
        active: true,
    });
    const defaultKubernetesAutoscaler = new alicloud.cs.KubernetesAutoscaler("default", {
        clusterId: defaultManagedKubernetes.id,
        utilization: "0.5",
        coolDownDuration: "10m",
        deferScaleInDuration: "10m",
        nodepools: [{
            id: defaultScalingConfiguration.scalingGroupId,
            labels: "a=b",
        }],
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    import pulumi_std as std
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "tf-example"
    default = alicloud.get_zones(available_resource_creation="VSwitch")
    default_get_images = alicloud.ecs.get_images(name_regex="^ubuntu_18.*64",
        most_recent=True,
        owners="system")
    default_get_instance_types = alicloud.ecs.get_instance_types(availability_zone=default.zones[0].id,
        cpu_core_count=4,
        memory_size=8,
        kubernetes_node_role="Worker")
    default_network = alicloud.vpc.Network("default",
        vpc_name=name,
        cidr_block="10.4.0.0/16")
    default_switch = alicloud.vpc.Switch("default",
        vswitch_name=name,
        cidr_block="10.4.0.0/24",
        vpc_id=default_network.id,
        zone_id=default.zones[0].id)
    default_managed_kubernetes = alicloud.cs.ManagedKubernetes("default",
        name_prefix=name,
        cluster_spec="ack.pro.small",
        worker_vswitch_ids=[default_switch.id],
        new_nat_gateway=True,
        pod_cidr=std.cidrsubnet(input="10.0.0.0/8",
            newbits=8,
            netnum=36).result,
        service_cidr=std.cidrsubnet(input="172.16.0.0/16",
            newbits=4,
            netnum=7).result,
        slb_internet_enabled=True)
    default_security_group = alicloud.ecs.SecurityGroup("default",
        name=name,
        vpc_id=default_network.id)
    default_scaling_group = alicloud.ess.ScalingGroup("default",
        scaling_group_name=name,
        min_size=1,
        max_size=1,
        vswitch_ids=[default_switch.id],
        removal_policies=[
            "OldestInstance",
            "NewestInstance",
        ])
    default_scaling_configuration = alicloud.ess.ScalingConfiguration("default",
        scaling_group_id=default_scaling_group.id,
        image_id=default_get_images.images[0].id,
        instance_type=default_get_instance_types.instance_types[0].id,
        security_group_id=default_security_group.id,
        force_delete=True,
        active=True)
    default_kubernetes_autoscaler = alicloud.cs.KubernetesAutoscaler("default",
        cluster_id=default_managed_kubernetes.id,
        utilization="0.5",
        cool_down_duration="10m",
        defer_scale_in_duration="10m",
        nodepools=[{
            "id": default_scaling_configuration.scaling_group_id,
            "labels": "a=b",
        }])
    
    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/ecs"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ess"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
    	"github.com/pulumi/pulumi-std/sdk/go/std"
    	"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 := "tf-example"
    		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
    		}
    		defaultGetImages, err := ecs.GetImages(ctx, &ecs.GetImagesArgs{
    			NameRegex:  pulumi.StringRef("^ubuntu_18.*64"),
    			MostRecent: pulumi.BoolRef(true),
    			Owners:     pulumi.StringRef("system"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		defaultGetInstanceTypes, err := ecs.GetInstanceTypes(ctx, &ecs.GetInstanceTypesArgs{
    			AvailabilityZone:   pulumi.StringRef(_default.Zones[0].Id),
    			CpuCoreCount:       pulumi.IntRef(4),
    			MemorySize:         pulumi.Float64Ref(8),
    			KubernetesNodeRole: pulumi.StringRef("Worker"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		defaultNetwork, err := vpc.NewNetwork(ctx, "default", &vpc.NetworkArgs{
    			VpcName:   pulumi.String(name),
    			CidrBlock: pulumi.String("10.4.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		defaultSwitch, err := vpc.NewSwitch(ctx, "default", &vpc.SwitchArgs{
    			VswitchName: pulumi.String(name),
    			CidrBlock:   pulumi.String("10.4.0.0/24"),
    			VpcId:       defaultNetwork.ID(),
    			ZoneId:      pulumi.String(_default.Zones[0].Id),
    		})
    		if err != nil {
    			return err
    		}
    		invokeCidrsubnet, err := std.Cidrsubnet(ctx, &std.CidrsubnetArgs{
    			Input:   "10.0.0.0/8",
    			Newbits: 8,
    			Netnum:  36,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		invokeCidrsubnet1, err := std.Cidrsubnet(ctx, &std.CidrsubnetArgs{
    			Input:   "172.16.0.0/16",
    			Newbits: 4,
    			Netnum:  7,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		defaultManagedKubernetes, err := cs.NewManagedKubernetes(ctx, "default", &cs.ManagedKubernetesArgs{
    			NamePrefix:  pulumi.String(name),
    			ClusterSpec: pulumi.String("ack.pro.small"),
    			WorkerVswitchIds: pulumi.StringArray{
    				defaultSwitch.ID(),
    			},
    			NewNatGateway:      pulumi.Bool(true),
    			PodCidr:            pulumi.String(invokeCidrsubnet.Result),
    			ServiceCidr:        pulumi.String(invokeCidrsubnet1.Result),
    			SlbInternetEnabled: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		defaultSecurityGroup, err := ecs.NewSecurityGroup(ctx, "default", &ecs.SecurityGroupArgs{
    			Name:  pulumi.String(name),
    			VpcId: defaultNetwork.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		defaultScalingGroup, err := ess.NewScalingGroup(ctx, "default", &ess.ScalingGroupArgs{
    			ScalingGroupName: pulumi.String(name),
    			MinSize:          pulumi.Int(1),
    			MaxSize:          pulumi.Int(1),
    			VswitchIds: pulumi.StringArray{
    				defaultSwitch.ID(),
    			},
    			RemovalPolicies: pulumi.StringArray{
    				pulumi.String("OldestInstance"),
    				pulumi.String("NewestInstance"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		defaultScalingConfiguration, err := ess.NewScalingConfiguration(ctx, "default", &ess.ScalingConfigurationArgs{
    			ScalingGroupId:  defaultScalingGroup.ID(),
    			ImageId:         pulumi.String(defaultGetImages.Images[0].Id),
    			InstanceType:    pulumi.String(defaultGetInstanceTypes.InstanceTypes[0].Id),
    			SecurityGroupId: defaultSecurityGroup.ID(),
    			ForceDelete:     pulumi.Bool(true),
    			Active:          pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = cs.NewKubernetesAutoscaler(ctx, "default", &cs.KubernetesAutoscalerArgs{
    			ClusterId:            defaultManagedKubernetes.ID(),
    			Utilization:          pulumi.String("0.5"),
    			CoolDownDuration:     pulumi.String("10m"),
    			DeferScaleInDuration: pulumi.String("10m"),
    			Nodepools: cs.KubernetesAutoscalerNodepoolArray{
    				&cs.KubernetesAutoscalerNodepoolArgs{
    					Id:     defaultScalingConfiguration.ScalingGroupId,
    					Labels: pulumi.String("a=b"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    using Std = Pulumi.Std;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "tf-example";
        var @default = AliCloud.GetZones.Invoke(new()
        {
            AvailableResourceCreation = "VSwitch",
        });
    
        var defaultGetImages = AliCloud.Ecs.GetImages.Invoke(new()
        {
            NameRegex = "^ubuntu_18.*64",
            MostRecent = true,
            Owners = "system",
        });
    
        var defaultGetInstanceTypes = AliCloud.Ecs.GetInstanceTypes.Invoke(new()
        {
            AvailabilityZone = @default.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
            CpuCoreCount = 4,
            MemorySize = 8,
            KubernetesNodeRole = "Worker",
        });
    
        var defaultNetwork = new AliCloud.Vpc.Network("default", new()
        {
            VpcName = name,
            CidrBlock = "10.4.0.0/16",
        });
    
        var defaultSwitch = new AliCloud.Vpc.Switch("default", new()
        {
            VswitchName = name,
            CidrBlock = "10.4.0.0/24",
            VpcId = defaultNetwork.Id,
            ZoneId = @default.Apply(@default => @default.Apply(getZonesResult => getZonesResult.Zones[0]?.Id)),
        });
    
        var defaultManagedKubernetes = new AliCloud.CS.ManagedKubernetes("default", new()
        {
            NamePrefix = name,
            ClusterSpec = "ack.pro.small",
            WorkerVswitchIds = new[]
            {
                defaultSwitch.Id,
            },
            NewNatGateway = true,
            PodCidr = Std.Cidrsubnet.Invoke(new()
            {
                Input = "10.0.0.0/8",
                Newbits = 8,
                Netnum = 36,
            }).Apply(invoke => invoke.Result),
            ServiceCidr = Std.Cidrsubnet.Invoke(new()
            {
                Input = "172.16.0.0/16",
                Newbits = 4,
                Netnum = 7,
            }).Apply(invoke => invoke.Result),
            SlbInternetEnabled = true,
        });
    
        var defaultSecurityGroup = new AliCloud.Ecs.SecurityGroup("default", new()
        {
            Name = name,
            VpcId = defaultNetwork.Id,
        });
    
        var defaultScalingGroup = new AliCloud.Ess.ScalingGroup("default", new()
        {
            ScalingGroupName = name,
            MinSize = 1,
            MaxSize = 1,
            VswitchIds = new[]
            {
                defaultSwitch.Id,
            },
            RemovalPolicies = new[]
            {
                "OldestInstance",
                "NewestInstance",
            },
        });
    
        var defaultScalingConfiguration = new AliCloud.Ess.ScalingConfiguration("default", new()
        {
            ScalingGroupId = defaultScalingGroup.Id,
            ImageId = defaultGetImages.Apply(getImagesResult => getImagesResult.Images[0]?.Id),
            InstanceType = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.InstanceTypes[0]?.Id),
            SecurityGroupId = defaultSecurityGroup.Id,
            ForceDelete = true,
            Active = true,
        });
    
        var defaultKubernetesAutoscaler = new AliCloud.CS.KubernetesAutoscaler("default", new()
        {
            ClusterId = defaultManagedKubernetes.Id,
            Utilization = "0.5",
            CoolDownDuration = "10m",
            DeferScaleInDuration = "10m",
            Nodepools = new[]
            {
                new AliCloud.CS.Inputs.KubernetesAutoscalerNodepoolArgs
                {
                    Id = defaultScalingConfiguration.ScalingGroupId,
                    Labels = "a=b",
                },
            },
        });
    
    });
    
    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.GetImagesArgs;
    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.ManagedKubernetes;
    import com.pulumi.alicloud.cs.ManagedKubernetesArgs;
    import com.pulumi.std.StdFunctions;
    import com.pulumi.std.inputs.CidrsubnetArgs;
    import com.pulumi.alicloud.ecs.SecurityGroup;
    import com.pulumi.alicloud.ecs.SecurityGroupArgs;
    import com.pulumi.alicloud.ess.ScalingGroup;
    import com.pulumi.alicloud.ess.ScalingGroupArgs;
    import com.pulumi.alicloud.ess.ScalingConfiguration;
    import com.pulumi.alicloud.ess.ScalingConfigurationArgs;
    import com.pulumi.alicloud.cs.KubernetesAutoscaler;
    import com.pulumi.alicloud.cs.KubernetesAutoscalerArgs;
    import com.pulumi.alicloud.cs.inputs.KubernetesAutoscalerNodepoolArgs;
    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 default = AlicloudFunctions.getZones(GetZonesArgs.builder()
                .availableResourceCreation("VSwitch")
                .build());
    
            final var defaultGetImages = EcsFunctions.getImages(GetImagesArgs.builder()
                .nameRegex("^ubuntu_18.*64")
                .mostRecent(true)
                .owners("system")
                .build());
    
            final var defaultGetInstanceTypes = EcsFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
                .availabilityZone(default_.zones()[0].id())
                .cpuCoreCount(4)
                .memorySize(8)
                .kubernetesNodeRole("Worker")
                .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(default_.zones()[0].id())
                .build());
    
            var defaultManagedKubernetes = new ManagedKubernetes("defaultManagedKubernetes", ManagedKubernetesArgs.builder()
                .namePrefix(name)
                .clusterSpec("ack.pro.small")
                .workerVswitchIds(defaultSwitch.id())
                .newNatGateway(true)
                .podCidr(StdFunctions.cidrsubnet(CidrsubnetArgs.builder()
                    .input("10.0.0.0/8")
                    .newbits(8)
                    .netnum(36)
                    .build()).result())
                .serviceCidr(StdFunctions.cidrsubnet(CidrsubnetArgs.builder()
                    .input("172.16.0.0/16")
                    .newbits(4)
                    .netnum(7)
                    .build()).result())
                .slbInternetEnabled(true)
                .build());
    
            var defaultSecurityGroup = new SecurityGroup("defaultSecurityGroup", SecurityGroupArgs.builder()
                .name(name)
                .vpcId(defaultNetwork.id())
                .build());
    
            var defaultScalingGroup = new ScalingGroup("defaultScalingGroup", ScalingGroupArgs.builder()
                .scalingGroupName(name)
                .minSize(1)
                .maxSize(1)
                .vswitchIds(defaultSwitch.id())
                .removalPolicies(            
                    "OldestInstance",
                    "NewestInstance")
                .build());
    
            var defaultScalingConfiguration = new ScalingConfiguration("defaultScalingConfiguration", ScalingConfigurationArgs.builder()
                .scalingGroupId(defaultScalingGroup.id())
                .imageId(defaultGetImages.images()[0].id())
                .instanceType(defaultGetInstanceTypes.instanceTypes()[0].id())
                .securityGroupId(defaultSecurityGroup.id())
                .forceDelete(true)
                .active(true)
                .build());
    
            var defaultKubernetesAutoscaler = new KubernetesAutoscaler("defaultKubernetesAutoscaler", KubernetesAutoscalerArgs.builder()
                .clusterId(defaultManagedKubernetes.id())
                .utilization("0.5")
                .coolDownDuration("10m")
                .deferScaleInDuration("10m")
                .nodepools(KubernetesAutoscalerNodepoolArgs.builder()
                    .id(defaultScalingConfiguration.scalingGroupId())
                    .labels("a=b")
                    .build())
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: tf-example
    resources:
      defaultNetwork:
        type: alicloud:vpc:Network
        name: default
        properties:
          vpcName: ${name}
          cidrBlock: 10.4.0.0/16
      defaultSwitch:
        type: alicloud:vpc:Switch
        name: default
        properties:
          vswitchName: ${name}
          cidrBlock: 10.4.0.0/24
          vpcId: ${defaultNetwork.id}
          zoneId: ${default.zones[0].id}
      defaultManagedKubernetes:
        type: alicloud:cs:ManagedKubernetes
        name: default
        properties:
          namePrefix: ${name}
          clusterSpec: ack.pro.small
          workerVswitchIds:
            - ${defaultSwitch.id}
          newNatGateway: true
          podCidr:
            fn::invoke:
              function: std:cidrsubnet
              arguments:
                input: 10.0.0.0/8
                newbits: 8
                netnum: 36
              return: result
          serviceCidr:
            fn::invoke:
              function: std:cidrsubnet
              arguments:
                input: 172.16.0.0/16
                newbits: 4
                netnum: 7
              return: result
          slbInternetEnabled: true
      defaultSecurityGroup:
        type: alicloud:ecs:SecurityGroup
        name: default
        properties:
          name: ${name}
          vpcId: ${defaultNetwork.id}
      defaultScalingGroup:
        type: alicloud:ess:ScalingGroup
        name: default
        properties:
          scalingGroupName: ${name}
          minSize: 1
          maxSize: 1
          vswitchIds:
            - ${defaultSwitch.id}
          removalPolicies:
            - OldestInstance
            - NewestInstance
      defaultScalingConfiguration:
        type: alicloud:ess:ScalingConfiguration
        name: default
        properties:
          scalingGroupId: ${defaultScalingGroup.id}
          imageId: ${defaultGetImages.images[0].id}
          instanceType: ${defaultGetInstanceTypes.instanceTypes[0].id}
          securityGroupId: ${defaultSecurityGroup.id}
          forceDelete: true
          active: true
      defaultKubernetesAutoscaler:
        type: alicloud:cs:KubernetesAutoscaler
        name: default
        properties:
          clusterId: ${defaultManagedKubernetes.id}
          utilization: '0.5'
          coolDownDuration: 10m
          deferScaleInDuration: 10m
          nodepools:
            - id: ${defaultScalingConfiguration.scalingGroupId}
              labels: a=b
    variables:
      default:
        fn::invoke:
          function: alicloud:getZones
          arguments:
            availableResourceCreation: VSwitch
      defaultGetImages:
        fn::invoke:
          function: alicloud:ecs:getImages
          arguments:
            nameRegex: ^ubuntu_18.*64
            mostRecent: true
            owners: system
      defaultGetInstanceTypes:
        fn::invoke:
          function: alicloud:ecs:getInstanceTypes
          arguments:
            availabilityZone: ${default.zones[0].id}
            cpuCoreCount: 4
            memorySize: 8
            kubernetesNodeRole: Worker
    

    📚 Need more examples? VIEW MORE EXAMPLES

    Ignoring Changes to tags and<span pulumi-lang-nodejs=" userData

    " pulumi-lang-dotnet=" UserData " pulumi-lang-go=" userData " pulumi-lang-python=" user_data " pulumi-lang-yaml=" userData " pulumi-lang-java=" userData “> user_data

    NOTE: You can utilize the generic Terraform resource lifecycle configuration block with ignore_changes to create a a autoscaler group, then ignore any changes to that tags and user_data caused externally (e.g. Application Autoscaling).

      # ... ignore the change about tags and user_data in alicloud_ess_scaling_configuration
      lifecycle {
        ignore_changes = [tags,user_data]
      }
    

    Create KubernetesAutoscaler Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new KubernetesAutoscaler(name: string, args: KubernetesAutoscalerArgs, opts?: CustomResourceOptions);
    @overload
    def KubernetesAutoscaler(resource_name: str,
                             args: KubernetesAutoscalerArgs,
                             opts: Optional[ResourceOptions] = None)
    
    @overload
    def KubernetesAutoscaler(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             cluster_id: Optional[str] = None,
                             cool_down_duration: Optional[str] = None,
                             defer_scale_in_duration: Optional[str] = None,
                             utilization: Optional[str] = None,
                             nodepools: Optional[Sequence[KubernetesAutoscalerNodepoolArgs]] = None,
                             use_ecs_ram_role_token: Optional[bool] = None)
    func NewKubernetesAutoscaler(ctx *Context, name string, args KubernetesAutoscalerArgs, opts ...ResourceOption) (*KubernetesAutoscaler, error)
    public KubernetesAutoscaler(string name, KubernetesAutoscalerArgs args, CustomResourceOptions? opts = null)
    public KubernetesAutoscaler(String name, KubernetesAutoscalerArgs args)
    public KubernetesAutoscaler(String name, KubernetesAutoscalerArgs args, CustomResourceOptions options)
    
    type: alicloud:cs:KubernetesAutoscaler
    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 KubernetesAutoscalerArgs
    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 KubernetesAutoscalerArgs
    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 KubernetesAutoscalerArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args KubernetesAutoscalerArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args KubernetesAutoscalerArgs
    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 kubernetesAutoscalerResource = new AliCloud.CS.KubernetesAutoscaler("kubernetesAutoscalerResource", new()
    {
        ClusterId = "string",
        CoolDownDuration = "string",
        DeferScaleInDuration = "string",
        Utilization = "string",
        Nodepools = new[]
        {
            new AliCloud.CS.Inputs.KubernetesAutoscalerNodepoolArgs
            {
                Id = "string",
                Labels = "string",
                Taints = "string",
            },
        },
        UseEcsRamRoleToken = false,
    });
    
    example, err := cs.NewKubernetesAutoscaler(ctx, "kubernetesAutoscalerResource", &cs.KubernetesAutoscalerArgs{
    	ClusterId:            pulumi.String("string"),
    	CoolDownDuration:     pulumi.String("string"),
    	DeferScaleInDuration: pulumi.String("string"),
    	Utilization:          pulumi.String("string"),
    	Nodepools: cs.KubernetesAutoscalerNodepoolArray{
    		&cs.KubernetesAutoscalerNodepoolArgs{
    			Id:     pulumi.String("string"),
    			Labels: pulumi.String("string"),
    			Taints: pulumi.String("string"),
    		},
    	},
    	UseEcsRamRoleToken: pulumi.Bool(false),
    })
    
    var kubernetesAutoscalerResource = new KubernetesAutoscaler("kubernetesAutoscalerResource", KubernetesAutoscalerArgs.builder()
        .clusterId("string")
        .coolDownDuration("string")
        .deferScaleInDuration("string")
        .utilization("string")
        .nodepools(KubernetesAutoscalerNodepoolArgs.builder()
            .id("string")
            .labels("string")
            .taints("string")
            .build())
        .useEcsRamRoleToken(false)
        .build());
    
    kubernetes_autoscaler_resource = alicloud.cs.KubernetesAutoscaler("kubernetesAutoscalerResource",
        cluster_id="string",
        cool_down_duration="string",
        defer_scale_in_duration="string",
        utilization="string",
        nodepools=[{
            "id": "string",
            "labels": "string",
            "taints": "string",
        }],
        use_ecs_ram_role_token=False)
    
    const kubernetesAutoscalerResource = new alicloud.cs.KubernetesAutoscaler("kubernetesAutoscalerResource", {
        clusterId: "string",
        coolDownDuration: "string",
        deferScaleInDuration: "string",
        utilization: "string",
        nodepools: [{
            id: "string",
            labels: "string",
            taints: "string",
        }],
        useEcsRamRoleToken: false,
    });
    
    type: alicloud:cs:KubernetesAutoscaler
    properties:
        clusterId: string
        coolDownDuration: string
        deferScaleInDuration: string
        nodepools:
            - id: string
              labels: string
              taints: string
        useEcsRamRoleToken: false
        utilization: string
    

    KubernetesAutoscaler 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 KubernetesAutoscaler resource accepts the following input properties:

    ClusterId string
    The id of kubernetes cluster.
    CoolDownDuration string
    The cool_down_duration option of cluster-autoscaler.
    DeferScaleInDuration string
    The defer_scale_in_duration option of cluster-autoscaler.
    Utilization string
    The utilization option of cluster-autoscaler.
    Nodepools List<Pulumi.AliCloud.CS.Inputs.KubernetesAutoscalerNodepool>
    The list of the node pools. See nodepools below.
    UseEcsRamRoleToken bool
    Enable autoscaler access to alibabacloud service by ecs ramrole token. default: false
    ClusterId string
    The id of kubernetes cluster.
    CoolDownDuration string
    The cool_down_duration option of cluster-autoscaler.
    DeferScaleInDuration string
    The defer_scale_in_duration option of cluster-autoscaler.
    Utilization string
    The utilization option of cluster-autoscaler.
    Nodepools []KubernetesAutoscalerNodepoolArgs
    The list of the node pools. See nodepools below.
    UseEcsRamRoleToken bool
    Enable autoscaler access to alibabacloud service by ecs ramrole token. default: false
    clusterId String
    The id of kubernetes cluster.
    coolDownDuration String
    The cool_down_duration option of cluster-autoscaler.
    deferScaleInDuration String
    The defer_scale_in_duration option of cluster-autoscaler.
    utilization String
    The utilization option of cluster-autoscaler.
    nodepools List<KubernetesAutoscalerNodepool>
    The list of the node pools. See nodepools below.
    useEcsRamRoleToken Boolean
    Enable autoscaler access to alibabacloud service by ecs ramrole token. default: false
    clusterId string
    The id of kubernetes cluster.
    coolDownDuration string
    The cool_down_duration option of cluster-autoscaler.
    deferScaleInDuration string
    The defer_scale_in_duration option of cluster-autoscaler.
    utilization string
    The utilization option of cluster-autoscaler.
    nodepools KubernetesAutoscalerNodepool[]
    The list of the node pools. See nodepools below.
    useEcsRamRoleToken boolean
    Enable autoscaler access to alibabacloud service by ecs ramrole token. default: false
    cluster_id str
    The id of kubernetes cluster.
    cool_down_duration str
    The cool_down_duration option of cluster-autoscaler.
    defer_scale_in_duration str
    The defer_scale_in_duration option of cluster-autoscaler.
    utilization str
    The utilization option of cluster-autoscaler.
    nodepools Sequence[KubernetesAutoscalerNodepoolArgs]
    The list of the node pools. See nodepools below.
    use_ecs_ram_role_token bool
    Enable autoscaler access to alibabacloud service by ecs ramrole token. default: false
    clusterId String
    The id of kubernetes cluster.
    coolDownDuration String
    The cool_down_duration option of cluster-autoscaler.
    deferScaleInDuration String
    The defer_scale_in_duration option of cluster-autoscaler.
    utilization String
    The utilization option of cluster-autoscaler.
    nodepools List<Property Map>
    The list of the node pools. See nodepools below.
    useEcsRamRoleToken Boolean
    Enable autoscaler access to alibabacloud service by ecs ramrole token. default: false

    Outputs

    All input properties are implicitly available as output properties. Additionally, the KubernetesAutoscaler 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 KubernetesAutoscaler Resource

    Get an existing KubernetesAutoscaler 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?: KubernetesAutoscalerState, opts?: CustomResourceOptions): KubernetesAutoscaler
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            cluster_id: Optional[str] = None,
            cool_down_duration: Optional[str] = None,
            defer_scale_in_duration: Optional[str] = None,
            nodepools: Optional[Sequence[KubernetesAutoscalerNodepoolArgs]] = None,
            use_ecs_ram_role_token: Optional[bool] = None,
            utilization: Optional[str] = None) -> KubernetesAutoscaler
    func GetKubernetesAutoscaler(ctx *Context, name string, id IDInput, state *KubernetesAutoscalerState, opts ...ResourceOption) (*KubernetesAutoscaler, error)
    public static KubernetesAutoscaler Get(string name, Input<string> id, KubernetesAutoscalerState? state, CustomResourceOptions? opts = null)
    public static KubernetesAutoscaler get(String name, Output<String> id, KubernetesAutoscalerState state, CustomResourceOptions options)
    resources:  _:    type: alicloud:cs:KubernetesAutoscaler    get:      id: ${id}
    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.
    The following state arguments are supported:
    ClusterId string
    The id of kubernetes cluster.
    CoolDownDuration string
    The cool_down_duration option of cluster-autoscaler.
    DeferScaleInDuration string
    The defer_scale_in_duration option of cluster-autoscaler.
    Nodepools List<Pulumi.AliCloud.CS.Inputs.KubernetesAutoscalerNodepool>
    The list of the node pools. See nodepools below.
    UseEcsRamRoleToken bool
    Enable autoscaler access to alibabacloud service by ecs ramrole token. default: false
    Utilization string
    The utilization option of cluster-autoscaler.
    ClusterId string
    The id of kubernetes cluster.
    CoolDownDuration string
    The cool_down_duration option of cluster-autoscaler.
    DeferScaleInDuration string
    The defer_scale_in_duration option of cluster-autoscaler.
    Nodepools []KubernetesAutoscalerNodepoolArgs
    The list of the node pools. See nodepools below.
    UseEcsRamRoleToken bool
    Enable autoscaler access to alibabacloud service by ecs ramrole token. default: false
    Utilization string
    The utilization option of cluster-autoscaler.
    clusterId String
    The id of kubernetes cluster.
    coolDownDuration String
    The cool_down_duration option of cluster-autoscaler.
    deferScaleInDuration String
    The defer_scale_in_duration option of cluster-autoscaler.
    nodepools List<KubernetesAutoscalerNodepool>
    The list of the node pools. See nodepools below.
    useEcsRamRoleToken Boolean
    Enable autoscaler access to alibabacloud service by ecs ramrole token. default: false
    utilization String
    The utilization option of cluster-autoscaler.
    clusterId string
    The id of kubernetes cluster.
    coolDownDuration string
    The cool_down_duration option of cluster-autoscaler.
    deferScaleInDuration string
    The defer_scale_in_duration option of cluster-autoscaler.
    nodepools KubernetesAutoscalerNodepool[]
    The list of the node pools. See nodepools below.
    useEcsRamRoleToken boolean
    Enable autoscaler access to alibabacloud service by ecs ramrole token. default: false
    utilization string
    The utilization option of cluster-autoscaler.
    cluster_id str
    The id of kubernetes cluster.
    cool_down_duration str
    The cool_down_duration option of cluster-autoscaler.
    defer_scale_in_duration str
    The defer_scale_in_duration option of cluster-autoscaler.
    nodepools Sequence[KubernetesAutoscalerNodepoolArgs]
    The list of the node pools. See nodepools below.
    use_ecs_ram_role_token bool
    Enable autoscaler access to alibabacloud service by ecs ramrole token. default: false
    utilization str
    The utilization option of cluster-autoscaler.
    clusterId String
    The id of kubernetes cluster.
    coolDownDuration String
    The cool_down_duration option of cluster-autoscaler.
    deferScaleInDuration String
    The defer_scale_in_duration option of cluster-autoscaler.
    nodepools List<Property Map>
    The list of the node pools. See nodepools below.
    useEcsRamRoleToken Boolean
    Enable autoscaler access to alibabacloud service by ecs ramrole token. default: false
    utilization String
    The utilization option of cluster-autoscaler.

    Supporting Types

    KubernetesAutoscalerNodepool, KubernetesAutoscalerNodepoolArgs

    Id string
    The scaling group id of the groups configured for cluster-autoscaler.
    Labels string
    The labels for the nodes in scaling group.
    Taints string
    The taints for the nodes in scaling group.
    Id string
    The scaling group id of the groups configured for cluster-autoscaler.
    Labels string
    The labels for the nodes in scaling group.
    Taints string
    The taints for the nodes in scaling group.
    id String
    The scaling group id of the groups configured for cluster-autoscaler.
    labels String
    The labels for the nodes in scaling group.
    taints String
    The taints for the nodes in scaling group.
    id string
    The scaling group id of the groups configured for cluster-autoscaler.
    labels string
    The labels for the nodes in scaling group.
    taints string
    The taints for the nodes in scaling group.
    id str
    The scaling group id of the groups configured for cluster-autoscaler.
    labels str
    The labels for the nodes in scaling group.
    taints str
    The taints for the nodes in scaling group.
    id String
    The scaling group id of the groups configured for cluster-autoscaler.
    labels String
    The labels for the nodes in scaling group.
    taints String
    The taints for the nodes in scaling group.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Viewing docs for Alibaba Cloud v3.97.0
    published on Saturday, Mar 14, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.