Skip to main content

node_pools

Creates, updates, deletes, gets or lists a node_pools resource.

Overview

Namenode_pools
TypeResource
Iddigitalocean.kubernetes.node_pools

Fields

The following fields are returned by SELECT queries:

The response will be a JSON object with a key called node_pool. The value
of this will be an object containing the standard attributes of a node pool.

NameDatatypeDescription
idstring (uuid)A unique ID that can be used to identify and reference a specific node pool. (example: cdda885e-7663-40c8-bc74-3a036c66545d)
namestringA human-readable name for the node pool. (example: frontend-pool)
auto_scalebooleanA boolean value indicating whether auto-scaling is enabled for this node pool.
countintegerThe number of Droplet instances in the node pool.
labelsobjectAn object of key/value mappings specifying labels to apply to all nodes in a pool. Labels will automatically be applied to all existing nodes and any subsequent nodes added to the pool. Note that when a label is removed, it is not deleted from the nodes in the pool.
max_nodesintegerThe maximum number of nodes that this node pool can be auto-scaled to. The value will be 0 if auto_scale is set to false.
min_nodesintegerThe minimum number of nodes that this node pool can be auto-scaled to. The value will be 0 if auto_scale is set to false.
nodesarrayAn object specifying the details of a specific worker node in a node pool.
sizestringThe slug identifier for the type of Droplet used as workers in the node pool. (example: s-1vcpu-2gb)
tagsarrayAn array containing the tags applied to the node pool. All node pools are automatically tagged k8s, k8s-worker, and k8s:$K8S_CLUSTER_ID.

Requires tag:read scope.
taintsarrayAn array of taints to apply to all nodes in a pool. Taints will automatically be applied to all existing nodes and any subsequent nodes added to the pool. When a taint is removed, it is deleted from all nodes in the pool.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
kubernetes_get_node_poolselectcluster_id, node_pool_idTo show information about a specific node pool in a Kubernetes cluster, send
a GET request to /v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID.
kubernetes_list_node_poolsselectcluster_idTo list all of the node pools in a Kubernetes clusters, send a GET request to
/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools.
kubernetes_add_node_poolinsertcluster_id, data__name, data__size, data__countTo add an additional node pool to a Kubernetes clusters, send a POST request
to /v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools with the following
attributes.
kubernetes_update_node_poolreplacecluster_id, node_pool_id, data__name, data__countTo update the name of a node pool, edit the tags applied to it, or adjust its
number of nodes, send a PUT request to
/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID with the
following attributes.
kubernetes_delete_node_pooldeletecluster_id, node_pool_idTo delete a node pool, send a DELETE request to
/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID.

A 204 status code with no body will be returned in response to a successful
request. Nodes in the pool will subsequently be drained and deleted.
kubernetes_recycle_node_poolexeccluster_id, node_pool_idThe endpoint has been deprecated. Please use the DELETE
/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID/nodes/$NODE_ID
method instead.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
cluster_idstring (uuid)A unique ID that can be used to reference a Kubernetes cluster. (example: bd5f5959-5e1e-4205-a714-a914373942af)
node_pool_idstring (uuid)A unique ID that can be used to reference a Kubernetes node pool. (example: cdda885e-7663-40c8-bc74-3a036c66545d)

SELECT examples

To show information about a specific node pool in a Kubernetes cluster, send
a GET request to /v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID.

SELECT
id,
name,
auto_scale,
count,
labels,
max_nodes,
min_nodes,
nodes,
size,
tags,
taints
FROM digitalocean.kubernetes.node_pools
WHERE cluster_id = '{{ cluster_id }}' -- required
AND node_pool_id = '{{ node_pool_id }}' -- required;

INSERT examples

To add an additional node pool to a Kubernetes clusters, send a POST request
to /v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools with the following
attributes.

INSERT INTO digitalocean.kubernetes.node_pools (
data__size,
data__name,
data__count,
data__tags,
data__labels,
data__taints,
data__auto_scale,
data__min_nodes,
data__max_nodes,
cluster_id
)
SELECT
'{{ size }}' --required,
'{{ name }}' --required,
{{ count }} --required,
'{{ tags }}',
'{{ labels }}',
'{{ taints }}',
{{ auto_scale }},
{{ min_nodes }},
{{ max_nodes }},
'{{ cluster_id }}'
RETURNING
node_pool
;

REPLACE examples

To update the name of a node pool, edit the tags applied to it, or adjust its
number of nodes, send a PUT request to
/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID with the
following attributes.

REPLACE digitalocean.kubernetes.node_pools
SET
data__name = '{{ name }}',
data__count = {{ count }},
data__tags = '{{ tags }}',
data__labels = '{{ labels }}',
data__taints = '{{ taints }}',
data__auto_scale = {{ auto_scale }},
data__min_nodes = {{ min_nodes }},
data__max_nodes = {{ max_nodes }}
WHERE
cluster_id = '{{ cluster_id }}' --required
AND node_pool_id = '{{ node_pool_id }}' --required
AND data__name = '{{ name }}' --required
AND data__count = '{{ count }}' --required
RETURNING
node_pool;

DELETE examples

To delete a node pool, send a DELETE request to
/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID.

A 204 status code with no body will be returned in response to a successful
request. Nodes in the pool will subsequently be drained and deleted.

DELETE FROM digitalocean.kubernetes.node_pools
WHERE cluster_id = '{{ cluster_id }}' --required
AND node_pool_id = '{{ node_pool_id }}' --required;

Lifecycle Methods

The endpoint has been deprecated. Please use the DELETE
/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID/nodes/$NODE_ID
method instead.

EXEC digitalocean.kubernetes.node_pools.kubernetes_recycle_node_pool 
@cluster_id='{{ cluster_id }}' --required,
@node_pool_id='{{ node_pool_id }}' --required
@@json=
'{
"nodes": "{{ nodes }}"
}';