Question: How to Scale Node Pools in a Vultr Kubernetes Engine Cluster
Scaling a Vultr Kubernetes Engine (VKE) cluster involves adjusting the number of worker nodes to match fluctuating workload demands. This can be done by either adding new Node Pools to expand the cluster or resizing existing ones, ensuring the cluster can efficiently handle changing application requirements while maintaining optimal performance. Vultr Kubernetes Engine offers an intuitive process for scaling Node Pools based on the needs of your application.
Follow this guide to scale a node pool in your Vultr Kubernetes Engine cluster on your Vultr account using the Vultr Customer Portal, API, CLI, or Terraform.
Vultr Customer Portal1.Navigate to
Products and click
Kubernetes.2.Click your target VKE cluster to open its management page.
3.Click
Nodes.4.To add a new Node Pool, click
Add Node Pool.
5.Select a
Node Pool Type and
Plan from the drop-down.
6.Provide a
Label and select
Number of Nodes to attach to the cluster.
7.Click
Create Node Pool. This will add a new Node Pool to the VKE cluster.
8.Click
Number of Nodes to resize any existing Node Pool.
9.Choose a Scaling Type amongst
Autoscale and
Manual.- For Autoscale: set the Minimum Nodes and Maximum Nodes.
- For Manual: set the number of Nodes.
10.Click
Apply to resize the Node Pool.
Vultr API
1.Send a GET request to the List all Kubernetes Clusters endpoint and note the target VKE cluster's ID.
[color=blue]console[/color]
$ curl "https://api.vultr.com/v2/kubernetes/clusters" \
-X GET \
-H "Authorization: Bearer $VULTR_API_KEY"
2.Send a POST request to the Create NodePool endpoint to add a new Node Pool to the VKE Cluster.
[color=blue]console[/color]
$ curl "https://api.vultr.com/v2/kubernetes/clusters/{cluster-id}/node-pools" \
-X POST \
-H "Authorization: Bearer ${VULTR_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"node_quantity": {number-of-nodes},
"min_nodes": {min-number-of-nodes},
"max_nodes": {max-number-of-nodes},
"auto_scaler": true,
"tag": "{tag}",
"label": "{node-label}",
"plan": "{node-plan}"
}'
Visit the Create NodePool page to view additional attributes you can apply while creating a new Node Pool for your VKE cluster.
3.Send a GET request to the List NodePools endpoint to view all Node Pools and note the target Node Pool's ID.
[color=purple]console[/color]
$ curl "https://api.vultr.com/v2/kubernetes/clusters/{cluster-id}/node-pools" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
4.Send a PATCH request to the Update NodePool endpoint to resize the target Node Pool.
[color=teal]console[/color]
$ curl "https://api.vultr.com/v2/kubernetes/clusters/{cluster-id}/node-pools/{node-pool-id}" \
-X PATCH \
-H "Authorization: Bearer ${VULTR_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"node_quantity": {number-of-nodes},
"min_nodes": {min-number-of-nodes},
"max_nodes": {max-number-of-nodes},
"auto_scaler": true,
"tag": "{tag}"
}'
Visit the Update NodePool page to view additional attributes you can apply while resizing your Node Pool.
Vultr CLI1.List the available VKE clusters in your Vultr account and note the target VKE cluster's ID.
[color=blue]console[/color]
$ vultr-cli kubernetes list --summarize
2.Add another Node Pool to the target VKE cluster.
[color=blue]console
[/color]
$ vultr-cli kubernetes node-pool create <cluster-id> \
--label "<node-label>" \
--plan "<node-plan>" \
--quantity <number-of-nodes> \
--min-nodes <min-number-of-nodes> \
--max-nodes <max-number-of-nodes> \
--auto-scaler true \
--tag "<tag>"
Run vultr-cli kubernetes node-pool create --help to view additional options you can apply while creating a new Node Pool for your VKE cluster.
3.List all the available Node Pools in the VKE cluster and note the target Node Pool's ID.
[color=blue]console[/color]
$ vultr-cli kubernetes node-pool list <cluster-id> --summarize
4.Resize the target Node Pool.
[color=blue]console[/color]
$ vultr-cli kubernetes node-pool update <cluster-id> <node-pool-id> \
--quantity <number-of-nodes> \
--min-nodes <min-number-of-nodes> \
--max-nodes <max-number-of-nodes> \
--auto-scaler true \
--tag "<tag>" \
--node-labels "<key1=value1,key2=value2>"
Run vultr-cli kubernetes node-pool update --help to view additional options you can apply while resizing your Node Pool.
Terraform1.Open your Terraform configuration for the existing VKE cluster.
2.Add a new node_pools block or update an existing one to change size or autoscaler settings, then apply.
[color=blue]terraform[/color]
resource "vultr_kubernetes" "vke" {
# ...existing fields (label, region, version)
# resize an existing pool
node_pools {
node_quantity = 5
label = "pool-a"
plan = "vc2-2c-4gb"
min_nodes = 3
max_nodes = 8
auto_scaler = true
}
# optionally add another node pool
node_pools {
node_quantity = 2
label = "pool-b"
plan = "vc2-2c-4gb"
}
}
3.Apply the configuration and observe the following output:
Apply complete! Resources: 0 added, 1 changed, 0 destroyed.