node_pools
Creates, updates, deletes, gets or lists a node_pools
resource.
Overview
Name | node_pools |
Type | Resource |
Id | digitalocean.kubernetes.node_pools |
Fields
The following fields are returned by SELECT
queries:
- kubernetes_get_node_pool
- kubernetes_list_node_pools
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.
Name | Datatype | Description |
---|---|---|
id | string (uuid) | A unique ID that can be used to identify and reference a specific node pool. (example: cdda885e-7663-40c8-bc74-3a036c66545d) |
name | string | A human-readable name for the node pool. (example: frontend-pool) |
auto_scale | boolean | A boolean value indicating whether auto-scaling is enabled for this node pool. |
count | integer | The number of Droplet instances in the node pool. |
labels | object | An 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_nodes | integer | The 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_nodes | integer | The 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 . |
nodes | array | An object specifying the details of a specific worker node in a node pool. |
size | string | The slug identifier for the type of Droplet used as workers in the node pool. (example: s-1vcpu-2gb) |
tags | array | An 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. |
taints | array | An 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. |
The response will be a JSON object with a key called node_pools
. This will
be set to an array of objects, each of which will contain the standard node
pool attributes.
Name | Datatype | Description |
---|---|---|
id | string (uuid) | A unique ID that can be used to identify and reference a specific node pool. (example: cdda885e-7663-40c8-bc74-3a036c66545d) |
name | string | A human-readable name for the node pool. (example: frontend-pool) |
auto_scale | boolean | A boolean value indicating whether auto-scaling is enabled for this node pool. |
count | integer | The number of Droplet instances in the node pool. |
labels | object | An 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_nodes | integer | The 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_nodes | integer | The 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 . |
nodes | array | An object specifying the details of a specific worker node in a node pool. |
size | string | The slug identifier for the type of Droplet used as workers in the node pool. (example: s-1vcpu-2gb) |
tags | array | An 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. |
taints | array | An 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:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
kubernetes_get_node_pool | select | cluster_id , node_pool_id | 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 . | |
kubernetes_list_node_pools | select | cluster_id | To 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_pool | insert | cluster_id , data__name , data__size , data__count | 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 followingattributes. | |
kubernetes_update_node_pool | replace | cluster_id , node_pool_id , data__name , data__count | 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 thefollowing attributes. | |
kubernetes_delete_node_pool | delete | cluster_id , node_pool_id | 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. | |
kubernetes_recycle_node_pool | exec | cluster_id , node_pool_id | 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. |
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.
Name | Datatype | Description |
---|---|---|
cluster_id | string (uuid) | A unique ID that can be used to reference a Kubernetes cluster. (example: bd5f5959-5e1e-4205-a714-a914373942af) |
node_pool_id | string (uuid) | A unique ID that can be used to reference a Kubernetes node pool. (example: cdda885e-7663-40c8-bc74-3a036c66545d) |
SELECT
examples
- kubernetes_get_node_pool
- kubernetes_list_node_pools
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;
To list all of the node pools in a Kubernetes clusters, send a GET request to/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools
.
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;
INSERT
examples
- kubernetes_add_node_pool
- Manifest
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
;
# Description fields are for documentation purposes
- name: node_pools
props:
- name: cluster_id
value: string (uuid)
description: Required parameter for the node_pools resource.
- name: size
value: string
description: >
The slug identifier for the type of Droplet used as workers in the node pool.
- name: name
value: string
description: >
A human-readable name for the node pool.
- name: count
value: integer
description: >
The number of Droplet instances in the node pool.
- name: tags
value: array
description: >
An array containing the tags applied to the node pool. All node pools are automatically tagged `k8s`, `k8s-worker`, and `k8s:$K8S_CLUSTER_ID`. <br><br>Requires `tag:read` scope.
- name: labels
value: object
description: >
An 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.
- name: taints
value: array
description: >
An 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.
- name: auto_scale
value: boolean
description: >
A boolean value indicating whether auto-scaling is enabled for this node pool.
- name: min_nodes
value: integer
description: >
The 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`.
- name: max_nodes
value: integer
description: >
The 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`.
REPLACE
examples
- kubernetes_update_node_pool
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
- kubernetes_delete_node_pool
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
- kubernetes_recycle_node_pool
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 }}"
}';