KubernetesNodePoolArgs

data class KubernetesNodePoolArgs(val autoScale: Output<Boolean>? = null, val clusterId: Output<String>? = null, val labels: Output<Map<String, String>>? = null, val maxNodes: Output<Int>? = null, val minNodes: Output<Int>? = null, val name: Output<String>? = null, val nodeCount: Output<Int>? = null, val size: Output<Either<String, DropletSlug>>? = null, val tags: Output<List<String>>? = null, val taints: Output<List<KubernetesNodePoolTaintArgs>>? = null) : ConvertibleToJava<KubernetesNodePoolArgs>

Provides a DigitalOcean Kubernetes node pool resource. While the default node pool must be defined in the digitalocean.KubernetesCluster resource, this resource can be used to add additional ones to a cluster.

Example Usage

Basic Example

import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
const foo = new digitalocean.KubernetesCluster("foo", {
name: "foo",
region: digitalocean.Region.NYC1,
version: "1.22.8-do.1",
nodePool: {
name: "front-end-pool",
size: "s-2vcpu-2gb",
nodeCount: 3,
},
});
const bar = new digitalocean.KubernetesNodePool("bar", {
clusterId: foo.id,
name: "backend-pool",
size: digitalocean.DropletSlug.DropletC2,
nodeCount: 2,
tags: ["backend"],
labels: {
service: "backend",
priority: "high",
},
taints: [{
key: "workloadKind",
value: "database",
effect: "NoSchedule",
}],
});
import pulumi
import pulumi_digitalocean as digitalocean
foo = digitalocean.KubernetesCluster("foo",
name="foo",
region=digitalocean.Region.NYC1,
version="1.22.8-do.1",
node_pool={
"name": "front-end-pool",
"size": "s-2vcpu-2gb",
"node_count": 3,
})
bar = digitalocean.KubernetesNodePool("bar",
cluster_id=foo.id,
name="backend-pool",
size=digitalocean.DropletSlug.DROPLET_C2,
node_count=2,
tags=["backend"],
labels={
"service": "backend",
"priority": "high",
},
taints=[{
"key": "workloadKind",
"value": "database",
"effect": "NoSchedule",
}])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;
return await Deployment.RunAsync(() =>
{
var foo = new DigitalOcean.KubernetesCluster("foo", new()
{
Name = "foo",
Region = DigitalOcean.Region.NYC1,
Version = "1.22.8-do.1",
NodePool = new DigitalOcean.Inputs.KubernetesClusterNodePoolArgs
{
Name = "front-end-pool",
Size = "s-2vcpu-2gb",
NodeCount = 3,
},
});
var bar = new DigitalOcean.KubernetesNodePool("bar", new()
{
ClusterId = foo.Id,
Name = "backend-pool",
Size = DigitalOcean.DropletSlug.DropletC2,
NodeCount = 2,
Tags = new[]
{
"backend",
},
Labels =
{
{ "service", "backend" },
{ "priority", "high" },
},
Taints = new[]
{
new DigitalOcean.Inputs.KubernetesNodePoolTaintArgs
{
Key = "workloadKind",
Value = "database",
Effect = "NoSchedule",
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
foo, err := digitalocean.NewKubernetesCluster(ctx, "foo", &digitalocean.KubernetesClusterArgs{
Name: pulumi.String("foo"),
Region: pulumi.String(digitalocean.RegionNYC1),
Version: pulumi.String("1.22.8-do.1"),
NodePool: &digitalocean.KubernetesClusterNodePoolArgs{
Name: pulumi.String("front-end-pool"),
Size: pulumi.String("s-2vcpu-2gb"),
NodeCount: pulumi.Int(3),
},
})
if err != nil {
return err
}
_, err = digitalocean.NewKubernetesNodePool(ctx, "bar", &digitalocean.KubernetesNodePoolArgs{
ClusterId: foo.ID(),
Name: pulumi.String("backend-pool"),
Size: pulumi.String(digitalocean.DropletSlugDropletC2),
NodeCount: pulumi.Int(2),
Tags: pulumi.StringArray{
pulumi.String("backend"),
},
Labels: pulumi.StringMap{
"service": pulumi.String("backend"),
"priority": pulumi.String("high"),
},
Taints: digitalocean.KubernetesNodePoolTaintArray{
&digitalocean.KubernetesNodePoolTaintArgs{
Key: pulumi.String("workloadKind"),
Value: pulumi.String("database"),
Effect: pulumi.String("NoSchedule"),
},
},
})
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.digitalocean.KubernetesCluster;
import com.pulumi.digitalocean.KubernetesClusterArgs;
import com.pulumi.digitalocean.inputs.KubernetesClusterNodePoolArgs;
import com.pulumi.digitalocean.KubernetesNodePool;
import com.pulumi.digitalocean.KubernetesNodePoolArgs;
import com.pulumi.digitalocean.inputs.KubernetesNodePoolTaintArgs;
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) {
var foo = new KubernetesCluster("foo", KubernetesClusterArgs.builder()
.name("foo")
.region("nyc1")
.version("1.22.8-do.1")
.nodePool(KubernetesClusterNodePoolArgs.builder()
.name("front-end-pool")
.size("s-2vcpu-2gb")
.nodeCount(3)
.build())
.build());
var bar = new KubernetesNodePool("bar", KubernetesNodePoolArgs.builder()
.clusterId(foo.id())
.name("backend-pool")
.size("c-2")
.nodeCount(2)
.tags("backend")
.labels(Map.ofEntries(
Map.entry("service", "backend"),
Map.entry("priority", "high")
))
.taints(KubernetesNodePoolTaintArgs.builder()
.key("workloadKind")
.value("database")
.effect("NoSchedule")
.build())
.build());
}
}
resources:
foo:
type: digitalocean:KubernetesCluster
properties:
name: foo
region: nyc1
version: 1.22.8-do.1
nodePool:
name: front-end-pool
size: s-2vcpu-2gb
nodeCount: 3
bar:
type: digitalocean:KubernetesNodePool
properties:
clusterId: ${foo.id}
name: backend-pool
size: c-2
nodeCount: 2
tags:
- backend
labels:
service: backend
priority: high
taints:
- key: workloadKind
value: database
effect: NoSchedule

Autoscaling Example

Node pools may also be configured to autoscale. For example:

import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
const autoscale_pool_01 = new digitalocean.KubernetesNodePool("autoscale-pool-01", {
clusterId: foo.id,
name: "autoscale-pool-01",
size: digitalocean.DropletSlug.DropletS1VCPU2GB,
autoScale: true,
minNodes: 1,
maxNodes: 5,
});
import pulumi
import pulumi_digitalocean as digitalocean
autoscale_pool_01 = digitalocean.KubernetesNodePool("autoscale-pool-01",
cluster_id=foo["id"],
name="autoscale-pool-01",
size=digitalocean.DropletSlug.DROPLET_S1_VCPU2_GB,
auto_scale=True,
min_nodes=1,
max_nodes=5)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;
return await Deployment.RunAsync(() =>
{
var autoscale_pool_01 = new DigitalOcean.KubernetesNodePool("autoscale-pool-01", new()
{
ClusterId = foo.Id,
Name = "autoscale-pool-01",
Size = DigitalOcean.DropletSlug.DropletS1VCPU2GB,
AutoScale = true,
MinNodes = 1,
MaxNodes = 5,
});
});
package main
import (
"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := digitalocean.NewKubernetesNodePool(ctx, "autoscale-pool-01", &digitalocean.KubernetesNodePoolArgs{
ClusterId: pulumi.Any(foo.Id),
Name: pulumi.String("autoscale-pool-01"),
Size: pulumi.String(digitalocean.DropletSlugDropletS1VCPU2GB),
AutoScale: pulumi.Bool(true),
MinNodes: pulumi.Int(1),
MaxNodes: pulumi.Int(5),
})
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.digitalocean.KubernetesNodePool;
import com.pulumi.digitalocean.KubernetesNodePoolArgs;
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) {
var autoscale_pool_01 = new KubernetesNodePool("autoscale-pool-01", KubernetesNodePoolArgs.builder()
.clusterId(foo.id())
.name("autoscale-pool-01")
.size("s-1vcpu-2gb")
.autoScale(true)
.minNodes(1)
.maxNodes(5)
.build());
}
}
resources:
autoscale-pool-01:
type: digitalocean:KubernetesNodePool
properties:
clusterId: ${foo.id}
name: autoscale-pool-01
size: s-1vcpu-2gb
autoScale: true
minNodes: 1
maxNodes: 5

Import

If you are importing an existing Kubernetes cluster with a single node pool, just import the cluster. Additional node pools can be imported by using their id, e.g.

$ pulumi import digitalocean:index/kubernetesNodePool:KubernetesNodePool mynodepool 9d76f410-9284-4436-9633-4066852442c8

Note: If the node pool has the terraform:default-node-pool tag, then it is a default node pool for an existing cluster. The provider will refuse to import the node pool in that case because the node pool is managed by the digitalocean_kubernetes_cluster resource and not by this digitalocean_kubernetes_node_pool resource.

Constructors

Link copied to clipboard
constructor(autoScale: Output<Boolean>? = null, clusterId: Output<String>? = null, labels: Output<Map<String, String>>? = null, maxNodes: Output<Int>? = null, minNodes: Output<Int>? = null, name: Output<String>? = null, nodeCount: Output<Int>? = null, size: Output<Either<String, DropletSlug>>? = null, tags: Output<List<String>>? = null, taints: Output<List<KubernetesNodePoolTaintArgs>>? = null)

Properties

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

Enable auto-scaling of the number of nodes in the node pool within the given min/max range.

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

The ID of the Kubernetes cluster to which the node pool is associated.

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

A map of key/value pairs to apply to nodes in the pool. The labels are exposed in the Kubernetes API as labels in the metadata of the corresponding Node resources.

Link copied to clipboard
val maxNodes: Output<Int>? = null

If auto-scaling is enabled, this represents the maximum number of nodes that the node pool can be scaled up to.

Link copied to clipboard
val minNodes: Output<Int>? = null

If auto-scaling is enabled, this represents the minimum number of nodes that the node pool can be scaled down to.

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

A name for the node pool.

Link copied to clipboard
val nodeCount: Output<Int>? = null

The number of Droplet instances in the node pool. If auto-scaling is enabled, this should only be set if the desired result is to explicitly reset the number of nodes to this value. If auto-scaling is enabled, and the node count is outside of the given min/max range, it will use the min nodes value.

Link copied to clipboard
val size: Output<Either<String, DropletSlug>>? = null

The slug identifier for the type of Droplet to be used as workers in the node pool.

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

A list of tag names to be applied to the Kubernetes cluster.

Link copied to clipboard

A list of taints applied to all nodes in the pool. This resource supports customized create timeouts. The default timeout is 30 minutes.

Functions

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