Destroy-cluster
March 7, 2024
Tags:
·
Create an Utho account to try this guide with a $100 credit.
Sign Up
Endpoint:
URL: https://api.utho.com/v2/kubernetes/750031/destroy
Method: DELETE
Headers:
- Authorization:
Bearer YOUR_BEARER_TOKEN
Payload:
{
"confirm": "I am aware this action will delete data and cluster permanently"
}
Response:
{
"k8s": [],
"status": "success",
"message": "Cluster has been deleted."
}
Instructions to Destroy Kubernetes Cluster
1. Using curl
(Command Line)
Run the following curl
command to destroy the Kubernetes cluster:
curl -X DELETE "https://api.utho.com/v2/kubernetes/750031/destroy" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"confirm": "I am aware this action will delete data and cluster permanently"}'
2. Using PHP
Here’s how you can send the DELETE request using PHP and cURL
:
<?php
$url = 'https://api.utho.com/v2/kubernetes/750031/destroy';
$data = array('confirm' => 'I am aware this action will delete data and cluster permanently');
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n",
'method' => 'DELETE',
'authorization' => 'Bearer YOUR_API_KEY',
'content' => json_encode($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) {
die('Error occurred');
}
echo $result;
?>
3. Using Python (with requests
library)
Here’s a Python example using the requests
library:
import requests
import json
url = 'https://api.utho.com/v2/kubernetes/750031/destroy'
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
payload = {'confirm': 'I am aware this action will delete data and cluster permanently'}
response = requests.delete(url, json=payload, headers=headers)
if response.status_code == 200:
print("Cluster has been deleted.")
else:
print(f"Error: {response.status_code}")
4. Using Node.js (with axios
library)
Here’s an example in Node.js using axios
:
const axios = require('axios');
const url = 'https://api.utho.com/v2/kubernetes/750031/destroy';
const payload = {
confirm: "I am aware this action will delete data and cluster permanently"
};
const headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer <your_api_token>',
};
axios.delete(url, { data: payload, headers: headers })
.then(response => {
console.log("Cluster has been deleted:", response.data);
})
.catch(error => {
console.error("Error:", error);
});
Create an Utho account to try this guide with a $100 credit.
Sign Up