# Kubernetes

The "Kubernetes" section allows for the management of Kubernetes clusters, supporting a multicloud approach. This means that worker nodes can be deployed on one cloud provider, such as Azure, while the master node is hosted on another, like Kraud.Cloud.

### CLUSTERS

## Get versions

<mark style="color:blue;">`GET`</mark> `{{BASE_URL}}/api/k8s/versions`

Get all available versions of Kubernetes.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer Token |

{% tabs %}
{% tab title="200: OK " %}

```json
[
    {
        "_id": "6548a383e2442d14b6bf969c",
        "name": "latest",
        "displayName": "Latest v1.28.1"
    },
    {
        "_id": "6548a383e2442d14b6bf969d",
        "name": "k8s_1.27.5",
        "displayName": "Kubernetes v1.27.5"
    },
    {
        "_id": "6548a383e2442d14b6bf969e",
        "name": "k8s_1.26.8",
        "displayName": "Kuberbetes v1.26.8"
    }
]
```

{% endtab %}
{% endtabs %}

Once the cluster is created, you can download the kubectl file to manage the k8s.

## Create k8s

<mark style="color:green;">`POST`</mark> `{{BASE_URL}}/api/clusters`

Cluster Creation. Currently, only ( Kraud.Cloud, Azure ) can be created.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer Token |

#### Request Body

| Name                                   | Type   | Description |
| -------------------------------------- | ------ | ----------- |
| data<mark style="color:red;">\*</mark> | Object |             |

{% tabs %}
{% tab title="201: Created " %}

```json
{
    "status": 0,
    "attestationId": "55f18486-6e07-4263-9e86-48a01b2761cd",
    "tags": [],
    "_id": "654904b9ff600e06af2a9759",
    "name": "k8s-development-1",
    "version": "6548a383e2442d14b6bf969c",
    "project": "6548a41f38406c14db33b62c",
    "team": "6548a41f38406c14db33b61e",
    "owner": "6548a41138406c14db33b606",
    "createdAt": "2023-11-06T15:22:33.826Z",
    "updatedAt": "2023-11-06T15:22:33.826Z"
}
```

{% endtab %}
{% endtabs %}

<details>

<summary>Request payload</summary>

```json
{
    "name": "k8s-development-1",
    "version": "6548a383e2442d14b6bf969c",
    "project": "6548a41f38406c14db33b62c",
    "tags": [],
    "masterNode": {
        "provider": "6548a383e2442d14b6bf9697",
        "cloudProvider": "6548a383e2442d14b6bf9685",
        "region": "6548a383e2442d14b6bf96aa",
        "datacenter": "berlin",
        "size": "6548a383e2442d14b6bf974c",
        "price": "6548a383e2442d14b6bf9712"
    },
    "pools": [
        {
            "name": "pool-0-kraud-1vCPUs-4RAM",
            "provider": "6548a383e2442d14b6bf9695",
            "cloudProvider": "6548a383e2442d14b6bf9685",
            "region": "6548a383e2442d14b6bf96a9",
            "datacenter": "berlin",
            "size": "6548a383e2442d14b6bf9748",
            "price": "6548a383e2442d14b6bf970e",
            "nodes": 1
        }
    ],
    "team": "6548a41f38406c14db33b61e"
}
```

</details>

***

## Get clusters

<mark style="color:blue;">`GET`</mark> `{{BASE_URL}}/api/teams/{team}/projects/{project}/clusters`

Get all active clusters for a specific project.

#### Path Parameters

| Name                                      | Type   | Description |
| ----------------------------------------- | ------ | ----------- |
| team<mark style="color:red;">\*</mark>    | String | Team ID     |
| project<mark style="color:red;">\*</mark> | String | Project ID  |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer Token |

{% tabs %}
{% tab title="200: OK " %}

```json
[
    {
        "_id": "654904b9ff600e06af2a9759",
        "status": 0,
        "attestationId": "55f18486-6e07-4263-9e86-48a01b2761cd",
        "name": "k8s-development-1",
        "version": {
            "_id": "6548a383e2442d14b6bf969c",
            "name": "latest",
            "displayName": "Latest v1.28.1"
        },
        "pools": [
            {
                "_id": "654904b9ff600e06af2a975c",
                "name": "pool-0-kraud-1vCPUs-4RAM",
                "provider": {
                    "_id": "6548a383e2442d14b6bf9695",
                    "type": "k8sNode",
                    "isDisabled": false,
                    "cloudProvider": {
                        "_id": "6548a383e2442d14b6bf9685",
                        "name": "Kraud.Cloud",
                        "isDisabled": false
                    }
                },
                "size": {
                    "_id": "6548a383e2442d14b6bf9748",
                    "provider": "6548a383e2442d14b6bf9695",
                    "location": "berlin",
                    "name": "Standart_berlin_1_4_50",
                    "vCPUs": 1,
                    "memoryGB": 4,
                    "spaceGB": 50,
                    "group": 0
                },
                "nodes": [
                    {
                        "_id": "654904b9ff600e06af2a975f",
                        "attestationId": "",
                        "status": 0,
                        "isBlocked": false,
                        "name": "pool-0-kraud-1vCPUs-4RAM_node0",
                        "ipConfigurations": [],
                        "attestation": null
                    }
                ]
            }
        ],
        "masterNode": {
            "_id": "654904b9ff600e06af2a975b",
            "name": "master-node",
            "attestationId": "",
            "status": 0,
            "isBlocked": false,
            "provider": {
                "_id": "6548a383e2442d14b6bf9697",
                "type": "k8sControlPlane",
                "isDisabled": false,
                "cloudProvider": {
                    "_id": "6548a383e2442d14b6bf9685",
                    "name": "Kraud.Cloud",
                    "isDisabled": false
                }
            },
            "size": {
                "_id": "6548a383e2442d14b6bf974c",
                "provider": "6548a383e2442d14b6bf9697",
                "location": "berlin",
                "name": "Standart_berlin_2_8_100",
                "vCPUs": 2,
                "memoryGB": 8,
                "spaceGB": 100,
                "group": 0
            },
            "ipConfigurations": [],
            "attestation": null
        }
    }
]
```

{% endtab %}
{% endtabs %}

## Stop cluster

<mark style="color:orange;">`PUT`</mark> `{{BASE_URL}}/api/clusters/{id}/stop`

Stop cluster by unique id.

#### Path Parameters

| Name                                 | Type   | Description |
| ------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark> | String | Cluster ID  |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer Token |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "_id": "6549ec825205cf0c45f24e54",
    "status": 3,
    "attestationId": "07e74c92-fb0b-4fff-a7d7-fb15d5a97032",
    "tags": [],
    "name": "k8s-development-1",
    "version": {
        "_id": "6548a383e2442d14b6bf969c",
        "name": "latest",
        "displayName": "Latest v1.28.1"
    },
    "project": "6548a41f38406c14db33b62c",
    "team": "6548a41f38406c14db33b61e",
    "owner": "6548a41138406c14db33b606",
    "createdAt": "2023-11-07T07:51:30.893Z",
    "updatedAt": "2023-11-07T08:05:19.056Z",
    "pools": [
        {
            "_id": "6549ec825205cf0c45f24e57",
            "name": "pool-0-kraud-1vCPUs-4RAM",
            "provider": {
                "_id": "6548a383e2442d14b6bf9695",
                "type": "k8sNode",
                "isDisabled": false,
                "cloudProvider": {
                    "_id": "6548a383e2442d14b6bf9685",
                    "name": "Kraud.Cloud",
                    "isDisabled": false
                }
            },
            "size": {
                "_id": "6548a383e2442d14b6bf9748",
                "provider": "6548a383e2442d14b6bf9695",
                "location": "berlin",
                "name": "Standart_berlin_1_4_50",
                "vCPUs": 1,
                "memoryGB": 4,
                "spaceGB": 50,
                "group": 0
            },
            "nodes": [
                {
                    "_id": "6549ec825205cf0c45f24e5a",
                    "attestationId": "",
                    "status": 1,
                    "isBlocked": true,
                    "name": "pool-0-kraud-1vCPUs-4RAM_node0",
                    "ipConfigurations": [
                        {
                            "_id": "6549ec8f5205cf0c45f24e84",
                            "type": "public",
                            "method": "Dynamic",
                            "version": "IPv4",
                            "address": "185.112.181.100"
                        }
                    ],
                    "attestation": null
                }
            ]
        }
    ],
    "masterNode": {
        "_id": "6549ec825205cf0c45f24e56",
        "name": "master-node",
        "attestationId": "",
        "status": 1,
        "isBlocked": true,
        "provider": {
            "_id": "6548a383e2442d14b6bf9697",
            "type": "k8sControlPlane",
            "isDisabled": false,
            "cloudProvider": {
                "_id": "6548a383e2442d14b6bf9685",
                "name": "Kraud.Cloud",
                "isDisabled": false
            }
        },
        "size": {
            "_id": "6548a383e2442d14b6bf974c",
            "provider": "6548a383e2442d14b6bf9697",
            "location": "berlin",
            "name": "Standart_berlin_2_8_100",
            "vCPUs": 2,
            "memoryGB": 8,
            "spaceGB": 100,
            "group": 0
        },
        "ipConfigurations": [
            {
                "_id": "6549ec935205cf0c45f24e8e",
                "type": "public",
                "method": "Dynamic",
                "version": "IPv4",
                "address": "185.112.181.102"
            }
        ],
        "attestation": null
    }
}
```

{% endtab %}
{% endtabs %}

## Start cluster

<mark style="color:orange;">`PUT`</mark> `{{BASE_URL}}/api/clusters/{id}/start`

Start cluster by unique id.

#### Path Parameters

| Name                                 | Type   | Description |
| ------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark> | String | Cluster ID  |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer Token |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "_id": "6549ec825205cf0c45f24e54",
    "status": 2,
    "attestationId": "07e74c92-fb0b-4fff-a7d7-fb15d5a97032",
    "tags": [],
    "name": "k8s-development-1",
    "version": {
        "_id": "6548a383e2442d14b6bf969c",
        "name": "latest",
        "displayName": "Latest v1.28.1"
    },
    "project": "6548a41f38406c14db33b62c",
    "team": "6548a41f38406c14db33b61e",
    "owner": "6548a41138406c14db33b606",
    "createdAt": "2023-11-07T07:51:30.893Z",
    "updatedAt": "2023-11-07T08:05:49.256Z",
    "pools": [
        {
            "_id": "6549ec825205cf0c45f24e57",
            "name": "pool-0-kraud-1vCPUs-4RAM",
            "provider": {
                "_id": "6548a383e2442d14b6bf9695",
                "type": "k8sNode",
                "isDisabled": false,
                "cloudProvider": {
                    "_id": "6548a383e2442d14b6bf9685",
                    "name": "Kraud.Cloud",
                    "isDisabled": false
                }
            },
            "size": {
                "_id": "6548a383e2442d14b6bf9748",
                "provider": "6548a383e2442d14b6bf9695",
                "location": "berlin",
                "name": "Standart_berlin_1_4_50",
                "vCPUs": 1,
                "memoryGB": 4,
                "spaceGB": 50,
                "group": 0
            },
            "nodes": [
                {
                    "_id": "6549ec825205cf0c45f24e5a",
                    "attestationId": "",
                    "status": 4,
                    "isBlocked": true,
                    "name": "pool-0-kraud-1vCPUs-4RAM_node0",
                    "ipConfigurations": [
                        {
                            "_id": "6549ec8f5205cf0c45f24e84",
                            "type": "public",
                            "method": "Dynamic",
                            "version": "IPv4",
                            "address": "185.112.181.100"
                        }
                    ],
                    "attestation": null
                }
            ]
        }
    ],
    "masterNode": {
        "_id": "6549ec825205cf0c45f24e56",
        "name": "master-node",
        "attestationId": "",
        "status": 4,
        "isBlocked": true,
        "provider": {
            "_id": "6548a383e2442d14b6bf9697",
            "type": "k8sControlPlane",
            "isDisabled": false,
            "cloudProvider": {
                "_id": "6548a383e2442d14b6bf9685",
                "name": "Kraud.Cloud",
                "isDisabled": false
            }
        },
        "size": {
            "_id": "6548a383e2442d14b6bf974c",
            "provider": "6548a383e2442d14b6bf9697",
            "location": "berlin",
            "name": "Standart_berlin_2_8_100",
            "vCPUs": 2,
            "memoryGB": 8,
            "spaceGB": 100,
            "group": 0
        },
        "ipConfigurations": [
            {
                "_id": "6549ec935205cf0c45f24e8e",
                "type": "public",
                "method": "Dynamic",
                "version": "IPv4",
                "address": "185.112.181.102"
            }
        ],
        "attestation": null
    }
}
```

{% endtab %}
{% endtabs %}

## Delete cluster

<mark style="color:red;">`DELETE`</mark> `{{BASE_URL}}/api/clusters/{id}`

Delete a specific cluster by unique id.

#### Path Parameters

| Name                                 | Type   | Description |
| ------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark> | String | Cluster ID  |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer Token |

{% tabs %}
{% tab title="200: OK " %}

```json
{"message":"ok"}
```

{% endtab %}
{% endtabs %}

***

### POOLS

The user can add pools to the created cluster and manage the pools.

## Create pool

<mark style="color:green;">`POST`</mark> `{{BASE_URL}}/api/pools`

Create a pool to a specific cluster.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer Token |

#### Request Body

| Name                                   | Type   | Description |
| -------------------------------------- | ------ | ----------- |
| data<mark style="color:red;">\*</mark> | Object |             |

{% tabs %}
{% tab title="201: Created " %}

```json
{
    "_id": "6549f1bb5205cf0c45f25071",
    "status": 0,
    "name": "pool-0-kraud-1vCPUs-4RAM",
    "provider": {
        "_id": "6548a383e2442d14b6bf9695",
        "type": "k8sNode",
        "isDisabled": false,
        "cloudProvider": {
            "_id": "6548a383e2442d14b6bf9685",
            "name": "Kraud.Cloud",
            "isDisabled": false
        }
    },
    "region": "6548a383e2442d14b6bf96a9",
    "datacenter": "berlin",
    "size": {
        "_id": "6548a383e2442d14b6bf9748",
        "provider": "6548a383e2442d14b6bf9695",
        "location": "berlin",
        "name": "Standart_berlin_1_4_50",
        "vCPUs": 1,
        "memoryGB": 4,
        "spaceGB": 50,
        "group": 0
    },
    "price": "6548a383e2442d14b6bf970e",
    "cluster": {
        "_id": "6549f05e5205cf0c45f24feb",
        "status": 2,
        "attestationId": "b4cef8ca-fed7-49b2-87a3-db7f67ee0e8d",
        "tags": [],
        "name": "k8s-development-1",
        "version": "6548a383e2442d14b6bf969c",
        "project": "6548a41f38406c14db33b62c",
        "team": "6548a41f38406c14db33b61e",
        "owner": "6548a41138406c14db33b606",
        "createdAt": "2023-11-07T08:07:58.630Z",
        "updatedAt": "2023-11-07T08:13:01.739Z"
    },
    "nodes": [
        {
            "_id": "6549f1bb5205cf0c45f25073",
            "attestationId": "",
            "status": 0,
            "isBlocked": false,
            "name": "pool-0-kraud-1vCPUs-4RAM_node0",
            "ipConfigurations": [],
            "attestation": null
        }
    ]
}
```

{% endtab %}
{% endtabs %}

<details>

<summary>Request payload</summary>

```json
{
    "name": "pool-0-kraud-1vCPUs-4RAM",
    "provider": "6548a383e2442d14b6bf9695",
    "region": "6548a383e2442d14b6bf96a9",
    "datacenter": "berlin",
    "size": "6548a383e2442d14b6bf9748",
    "price": "6548a383e2442d14b6bf970e",
    "nodes": 1,
    "cluster": "6549f05e5205cf0c45f24feb"
}
```

</details>

***

## Delete pool

<mark style="color:red;">`DELETE`</mark> `{{BASE_URL}}/api/pools/{id}`

Delete a specific pool by unique id.

#### Path Parameters

| Name                                 | Type   | Description |
| ------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark> | String | Pool ID     |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer Token |

{% tabs %}
{% tab title="200: OK " %}

```json
{"message":"ok"}
```

{% endtab %}
{% endtabs %}

***

### NODES

The user can delete nodes. Note that a user can only delete a worker node.

## Delete node

<mark style="color:red;">`DELETE`</mark> `{{BASE_URL}}/api/nodes/{id}`

Delete a specific node by unique id. Currently, only worker node can be deleted.

#### Path Parameters

| Name                                 | Type   | Description |
| ------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark> | String | Pool ID     |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer Token |

{% tabs %}
{% tab title="200: OK " %}

```json
{"message":"ok"}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.enclaive.cloud/enclaive-multi-cloud-platform/developers/api/client-api/manage/kubernetes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
