pydo.kubernetes.add_node_pool()

Description

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.

Parameters

Name Type Required Description Default Value
cluster_id string True A unique ID that can be used to reference a Kubernetes cluster.
body JSON or IO[bytes] True

Request Sample

import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

req = {
  "size": "s-1vcpu-2gb",
  "count": 3,
  "name": "new-pool",
  "tags": [
    "frontend"
  ],
  "auto_scale": True,
  "min_nodes": 3,
  "max_nodes": 6
}

resp = client.kubernetes.add_node_pool(cluster_id="ba9d8da", body=req)

Responses

See the API spec for this endpoint to view additional detail on responses, headers, parameters, and more.

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.

Click to expand an example response.
{
  "node_pool": {
    "id": "cdda885e-7663-40c8-bc74-3a036c66545d",
    "name": "new-pool",
    "size": "s-1vcpu-2gb",
    "count": 3,
    "tags": [
      "production",
      "web-team",
      "front-end",
      "k8s",
      "k8s:bd5f5959-5e1e-4205-a714-a914373942af",
      "k8s:worker"
    ],
    "labels": null,
    "taints": [],
    "auto_scale": true,
    "min_nodes": 3,
    "max_nodes": 6,
    "nodes": [
      {
        "id": "478247f8-b1bb-4f7a-8db9-2a5f8d4b8f8f",
        "name": " ",
        "status": {
          "state": "provisioning"
        },
        "droplet_id": " ",
        "created_at": "2018-11-15T16:00:11Z",
        "updated_at": "2018-11-15T16:00:11Z"
      },
      {
        "id": "ad12e744-c2a9-473d-8aa9-be5680500eb1",
        "name": " ",
        "status": {
          "state": "provisioning"
        },
        "droplet_id": " ",
        "created_at": "2018-11-15T16:00:11Z",
        "updated_at": "2018-11-15T16:00:11Z"
      },
      {
        "id": "e46e8d07-f58f-4ff1-9737-97246364400e",
        "name": " ",
        "status": {
          "state": "provisioning"
        },
        "droplet_id": " ",
        "created_at": "2018-11-15T16:00:11Z",
        "updated_at": "2018-11-15T16:00:11Z"
      }
    ]
  }
}

Unauthorized

Click to expand an example response.
{
  "id": "unauthorized",
  "message": "Unable to authenticate you."
}

The resource was not found.

Click to expand an example response.
{
  "id": "not_found",
  "message": "The resource you requested could not be found."
}

API Rate limit exceeded

Click to expand an example response.
{
  "id": "too_many_requests",
  "message": "API Rate limit exceeded."
}

Server error.

Click to expand an example response.
{
  "id": "server_error",
  "message": "Unexpected server-side error"
}

Unexpected error

Click to expand an example response.
{
  "id": "example_error",
  "message": "some error message"
}