# Remove a Kubernetes node pool

Delete a node pool. The node pool is returned as `deleting`, with a `node_count` of 0. We then move the pods off the node pool's workers and remove the workers. Once deleted, the node pool stays available as `destroyed`. Pods get up to 5 minutes to move off a worker. A worker can be removed before every pod has left.

[endpoint]
method = "DELETE"
base_url = "https://{availability_zone}.betterstackcloud.com"
path = "/v1/kubernetes-clusters/{kubernetes_cluster_id}/node-pools/{id}"

[[path_param]]
name = "kubernetes_cluster_id"
required = true
type = "string"
description = "The ID of the Kubernetes cluster."

[[path_param]]
name = "id"
required = true
type = "string"
description = "The ID of the Kubernetes node pool to remove."

[[header]]
name = "Authorization"
description = "Bearer `$TOKEN`"
required = true
type = "string"
[/endpoint]

[responses]
[[response]]
status = 202
description = "Returns the Kubernetes node pool."
body = '''
{
  "id": "example",
  "name": "Example Kubernetes node pool",
  "server_type": "AM2",
  "node_count": 1,
  "labels": {
    "example": "value"
  },
  "taints": [
    {
      "key": "example",
      "value": "example",
      "effect": "NoSchedule"
    }
  ],
  "status": "active",
  "status_message": "example",
  "nodes_ready": 1,
  "scaling": {
    "from": 1,
    "to": 1,
    "started_at": "2026-07-01T12:00:00.000Z",
    "estimated_ready_at": "2026-07-01T12:00:00.000Z"
  },
  "nodes": [
    {
      "id": "example",
      "name": "Example",
      "server_id": "123456789",
      "status": "queued",
      "version": "1.4.2",
      "last_seen_at": "2026-07-01T12:00:00.000Z"
    }
  ]
}
'''

[[response]]
status = 400
description = "The body isn't valid JSON."
body = '''
{
  "error": {
    "message": "Malformed JSON body.",
    "code": "bad_request"
  }
}
'''

[[response]]
status = 401
description = "The API token is missing or invalid."
body = '''
{
  "error": {
    "message": "Missing or invalid token.",
    "code": "unauthorized"
  }
}
'''

[[response]]
status = 402
description = "The organization hasn't made its first payment yet, and the request creates a resource we charge for. The code is `payment_required`. A request that creates a server, load balancer, object cache, database, reserved IP or volume can also return `first_purchase`. The `url` in `first_purchase` opens a page where you make the payment. The resource is created after the payment. The page works until `expires_at`, 24 hours after the response."
body = '''
{
  "error": {
    "message": "We require at least one successful credit card transaction before allowing billable actions via the API. This significantly helps us to prevent fraud. Once your first transaction is processed, you will be able to use the API unrestricted. Please add credit to your account at https://betterstack.com/settings/billing/card/new?credits=10&activate_api=true. Need help? We're here for you at hello@betterstack.com.",
    "code": "payment_required"
  }
}
'''

[[response]]
status = 403
description = "The request would go over a quota, with the code `quota_exceeded`. Or a read-only token tried to make a change, with the code `read_only_token`. Or a rule of the resource forbids it."
body = '''
{
  "error": {
    "message": "This token is read-only and cannot be used for write operations.",
    "code": "read_only_token"
  }
}
'''

[[response]]
status = 404
description = "The resource doesn't exist, it's in another zone, or your token can't access it."
body = '''
{
  "error": {
    "message": "Resource not found.",
    "code": "not_found"
  }
}
'''

[[response]]
status = 409
description = "The resource's state doesn't allow the request, such as starting a running server or removing a placement group that still has servers."

[[response]]
status = 423
description = "We've locked the resource, with the code `locked`. Every change to a locked resource is refused, and so is a change that involves one."

[[response]]
status = 429
description = "Too many requests, with the code `rate_limited`. We limit requests per client IP and per organization, and some costly endpoints have a stricter limit. Wait as long as the `Retry-After` header says."

[[response]]
status = 500
description = "An unexpected, temporary error on our side, with the code `internal_error`. Try again."
body = '''
{
  "error": {
    "message": "The request could not be completed right now. Please try again in a few moments.",
    "code": "internal_error"
  }
}
'''

[[response]]
status = 503
description = "The zone has no capacity, with the code `no_capacity`. Or we couldn't set up or change the resource, with the code `orchestration_failed`. Or the organization is creating too many resources at the same time, with the code `concurrent_create_limit`. Try again after a short wait."
[/responses]

[params]
title = "Response attributes"

[[param]]
name = "id"
type = "string"
description = "The node pool's ID, a UUID."

[[param]]
name = "name"
type = "string"
description = "The node pool's name, unique among the cluster's node pools."

[[param]]
name = "server_type"
type = "string"
description = "The server type of the workers."

[[param]]
name = "node_count"
type = "integer"
description = "How many workers the node pool should have, from 0 to 100. The node pools of a cluster can have 100 workers in total. `nodes` lists the workers the node pool has now."

[[param]]
name = "labels"
type = "object"
description = "The Kubernetes labels of the workers, as string pairs, or an empty object when there are none."

[[param]]
name = "taints"
type = "array of objects"
description = "The Kubernetes taints of the workers, or an empty list when there are none."

[[param]]
name = "taints[].key"
type = "string"
description = "The taint's key."

[[param]]
name = "taints[].value"
type = "string or null"
description = "The taint's value, or `null` when the taint has none."

[[param]]
name = "taints[].effect"
type = "string"
description = "What the taint does to pods that don't tolerate it, as in Kubernetes. Possible values: `NoSchedule`, `PreferNoSchedule`, `NoExecute`."

[[param]]
name = "status"
type = "string"
description = "The node pool's state. The node pool is ready when the cluster is `running` and every worker of the node pool is `ready`.<br/>Valid values:<br/>`active`: The node pool isn't changing size. The node pool's workers can still be joining or being replaced.<br/>`scaling`: We're adding or removing workers to reach `node_count`. Scaling happens after you change `node_count`, or when the node pool has more or fewer workers than `node_count`.<br/>`deleting`: We're removing the node pool.<br/>`destroyed`: The node pool is deleted."

[[param]]
name = "status_message"
type = "string or null"
description = "Why the node pool has fewer workers than `node_count`, such as a quota limit, no capacity for the server type in the zone, or a server we couldn't create. Is `null` again once the node pool reaches `node_count`."

[[param]]
name = "nodes_ready"
type = "integer"
description = "How many workers of the node pool are `ready`."

[[param]]
name = "scaling"
type = "object or null"
description = "How a change of size is going while `status` is `scaling`, or `null` otherwise."

[[param]]
name = "scaling.from"
type = "integer or null"
description = "The number of workers before the change."

[[param]]
name = "scaling.to"
type = "integer"
description = "The `node_count` to reach."

[[param]]
name = "scaling.started_at"
type = "datetime"
description = "When the change started. In ISO 8601 format, such as `2026-07-01T12:00:00Z`."

[[param]]
name = "scaling.estimated_ready_at"
type = "datetime"
description = "When we expect the change to be done. When workers are added, it's based on the usual time a worker of the server type needs to be ready in this zone. When workers are removed, it's the latest time every removed worker is gone. In ISO 8601 format, such as `2026-07-01T12:00:00Z`."

[[param]]
name = "nodes"
type = "array of objects"
description = "The node pool's workers, sorted by `name`. New workers show up at once as `queued`, then go through `provisioning` and `joining` to `ready`."

[[param]]
name = "nodes[].id"
type = "string"
description = "The worker's ID. Use it to recycle the worker."

[[param]]
name = "nodes[].name"
type = "string"
description = "The worker's name in Kubernetes."

[[param]]
name = "nodes[].server_id"
type = "string or null"
description = "The ID of the server that runs the worker, or `null` while the worker is `queued`."

[[param]]
name = "nodes[].status"
type = "string"
description = "The worker's state.<br/>Valid values:<br/>`queued`: We'll create the worker.<br/>`provisioning`: We're creating the worker's server.<br/>`joining`: The worker is joining the cluster.<br/>`ready`: The worker is ready in Kubernetes.<br/>`not_ready`: The worker joined, but Kubernetes reports it as not ready.<br/>`draining`: We're moving pods off the worker before we remove it.<br/>`replacing`: We're creating a new worker to replace this one.<br/>`destroyed`: The worker is removed."

[[param]]
name = "nodes[].version"
type = "string or null"
description = "The Kubernetes version the worker reports."

[[param]]
name = "nodes[].last_seen_at"
type = "datetime or null"
description = "When we last saw the worker ready. In ISO 8601 format, such as `2026-07-01T12:00:00Z`."
[/params]
