1. Home
  2. Knowledge Base
  3. Product
  4. Compute
  5. Managing Kubernetes clusters Using OpenStack API

Managing Kubernetes clusters Using OpenStack API

This guide covers essential operations for managing a Kubernetes cluster in CloudPE environment using the API, including listing,creating,deleting cluster templates,also listing kubernetes cluster,creating a cluster, getting kubernetes cluster config data,showing kubernets cluster details, resizing kubernetes clusters, upgrading kubernetes clusters and deleting the kubernetes clusters.

Note: Ensure the following tools are installed:

jq (for JSON parsing)

curl

Install curl

CentOS / RHEL / AlmaLinux / Rocky Linux

sudo yum install curl -y

Ubuntu / Debian

sudo apt update
sudo apt install curl -y

Install jq

Ubuntu / Debian

sudo apt update
sudo apt install -y jq

CentOS / RHEL / AlmaLinux

sudo yum install -y jq

Verify Installation:

jq –version

curl –version

1 Listing Kubernetes cluster templates

curl -ks -H ‘Content-Type: application/json’ -H ‘OpenStack-API-Version: container-infra 1.8’ -H “X-Auth-Token: $TOKEN” https://<node_IP_addr>:9513/v1/clustertemplates

You will get the following output


Note:
Here https://<node_IP_addr> should be replaced with the appropriate regional URL based on where your cluster is created:

For West3https://in-west3.controlcloud.app:9513

For West2https://in-west2.controlcloud.app:9513

2 Creating Kubernetes cluster templates

curl -ks -X POST \
-H “Content-Type: application/json” \
-H “OpenStack-API-Version: container-infra 1.8” \
-H “X-Auth-Token: $TOKEN” \
-d ‘{
“name”: “kub2_template”,
“server_type”: “vm”,
“cluster_distro”: “fedora-coreos”,
“image_id”: “b92ee4c4-6030-4e6b-821f-896ee11e286e”,
“volume_driver”: “cinder”,
“docker_storage_driver”: “overlay2”,
“docker_volume_size”: 20,
“network_driver”: “cilium”,
“coe”: “kubernetes”,
“master_lb_enabled”: true,
“floating_ip_enabled”: false,
“fixed_network”: “6c4c7495-7596-40eb-8733-eee93cfaf62c”,
“fixed_subnet”: “134d6045-4662-43ac-88fc-85416c7b3ea7”,
“external_network_id”: “6c4c7495-7596-40eb-8733-eee93cfaf62c”,
“labels”: {
“kube_tag”: “v1.29.0”,
“cloud_provider_enabled”: “true”,
“boot_volume_type”: “default”,
“boot_volume_size”: “20”,
“heat_container_agent_tag”: “latest”,
“docker_volume_type”: “default”
}
}’ \
https://<node_IP_addr>:9513/v1/clustertemplates

You will get the following output

3 Showing Kubernetes cluster template details

curl -ks \
-H “Content-Type: application/json” \
-H “OpenStack-API-Version: container-infra 1.8” \
-H “X-Auth-Token: $TOKEN” \
https://<node_IP_addr>:9513/v1/clustertemplates

You will get the following output

4 Deleting Kubernetes cluster templates

curl -ks -X DELETE \
-H “Content-Type: application/json” \
-H “OpenStack-API-Version: container-infra 1.8” \
-H “X-Auth-Token: $TOKEN” \
https://<node_IP_addr>:9513/v1/clustertemplates/<template_UUID>

You will get the following output

Here you can confirm templates deleted or not using the below command

curl -ks \
-H “OpenStack-API-Version: container-infra 1.8” \
-H “X-Auth-Token: $TOKEN” \
https://<node_IP_addr>:9513/v1/clustertemplates/<template_UUID>Expected outcomes:

If it was successfully deleted:
You’ll get an empty response or an error like 404 Not Found.

If it exists:
You’ll get a JSON response showing its details (like name, COE, labels, etc.).

5 Listing Kubernetes clusters

curl -ks \
-H “Content-Type: application/json” \
-H “OpenStack-API-Version: container-infra 1.8” \
-H “X-Auth-Token: $TOKEN” \
https://<node_IP_addr>:9513/v1/clusters

You will get the following output

6 Creating Kubernetes clusters

curl -ks -X POST \
-H “Content-Type: application/json” \
-H “OpenStack-API-Version: container-infra 1.8” \
-H “X-Auth-Token: $TOKEN” \
-d ‘{
“name”: “kub1312-cluster”,
“cluster_template_id”: “”,
“master_count”: 1,
“node_count”: 2,
“flavor_id”: “a.cpu1.8g”,
“master_flavor_id”: “a.cpu1.8g”,
“keypair”: “key1”,
“docker_volume_size”: 20,
“create_timeout”: 60,
“floating_ip_enabled”: true
}’ \
https://<node_IP_addr>:9513/v1/clusters

You will get the following output. Cluster will be created in Cloudpe panel.


7 Showing Kubernetes cluster details

curl -ks \
-H “Content-Type: application/json” \
-H “X-Auth-Token: $TOKEN” \
https://<node_IP_addr>:9513/v1/clusters/e1a07e0b-60b1-4a86-b874-c9f485de5106 | jq


Note: The jq command is used to format (pretty-print) JSON output, making it easier to read and understand the API response. It doesn’t affect the command’s functionality — it’s only for better readability of the output.

You will get the following Output

8 Resizing Kubernetes clusters

curl -ks -X PATCH \
-H “Content-Type: application/json” \
-H “OpenStack-API-Version: container-infra latest” \
-H “X-Auth-Token: $TOKEN” \
-d ‘[{“op”: “replace”, “path”: “/node_count”, “value”: 2}]’ \
https://<node_IP_addr>:9513/v1/clusters/e1a07e0b-60b1-4a86-b874-c9f485de51

Here Cluster ID = e1a07e0b-60b1-4a86-b874-c9f485de51

You will get the following output. Node will be created under clusters

Scale up worker nodes to 3:

-d '[{"op": "replace", "path": "/node_count", "value": 3}]'

Scale down worker nodes to 1:

-d '[{"op": "replace", "path": "/node_count", "value": 1}]'

9 Upgrading Kubernetes clusters

curl -ks -X POST \
-H “Content-Type: application/json” \
-H “OpenStack-API-Version: container-infra 1.8” \
-H “X-Auth-Token: $TOKEN” \
-d ‘{
“cluster_template”: “8be93631-02ff-402d-abd9-29cd8b7f7a7f”,
“max_batch_size”: 1
}’ \
https://<node_IP_addr>:9513/v1/clusters/e1a07e0b-60b1-4a86-b874-c9f485de51/actions/upgrade

Here Cluster ID = e1a07e0b-60b1-4a86-b874-c9f485de51

Note = 📝 Note: The Kubernetes cluster upgrade option will be available only after the associated cluster templates are upgraded to a newer version.

10 Deleting Kubernets clusters.

curl -ks -X DELETE \
-H “Content-Type: application/json” \
-H “OpenStack-API-Version: container-infra 1.8” \
-H “X-Auth-Token: $TOKEN” \
https://i<node_IP_addr>9513/v1/clusters/e1a07e0b-60b1-4a86-b874-c9f485de510

Note = Deleting a cluster is irreversible — it will permanently remove all nodes, workloads, and associated resources from OpenStack.

You can confirm wheather deleted or not using kubernets clusters listing command

Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support
This is a staging environment