Kubernetes

Create an API Key and access token:-

For create a API Key and Access Token to refer this link :-

https://www.e2enetworks.com/help/knowledge-base/how-to-create-an-api-access-token/

List of Kubernetes

To find the list of Kubernetes, send a HTTP GET request :-

https://api.e2enetworks.com/myaccount/api/v1/kubernetes/?apikey={{api_key}}&location=Delhi&project_id={{project-id}}

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "code": 200,
    "data": [
        {
            "service_id": 4224,
            "service_name": "E2E-K8s-Cluster-441",
            "roles": [
                {
                    "role_name": "master",
                    "cardinality": 1,
                    "min_vms": null,
                    "max_vms": null,
                    "cooldown": 300,
                    "state": "Running",
                    "elasticity_policies": [],
                    "node_id_list": [
                        133442
                    ]
                }
            ],
            "state": "Running",
            "auto_scale_enabled": false,
            "plan_name": "E2E-K8s-Cluster",
            "version": "1.23",
            "master_node_id": 121161,
            "created_at": "Apr 04, 2023 02:42:45 PM",
            "cluster_id": 1201
        },
    ],
    "errors": {},
    "message": "Success"
    }

Create a new Kubernetes

To create a Kubernetes , send a Post request :-

https://api.e2enetworks.com/myaccount/api/v1/kubernetes/?apikey={{api_key}}&location=Delhi&project_id={{project-id}}
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{

"name": "E2E-K8s-Cluster-441",
"version": "1.23",
"slug_name": "C3-4vCPU-8RAM-100DISK-3rdGen-K8s1_23-master-metal-lb",
"vpc_id": "10660",
"sku_id": "1178",
"node_pools": [
    {
        "name": "pool-mueht",
        "slug_name": "C3-4vCPU-8RAM-100DISK-C3.8GB-CentOS-Stream",
        "sku_id": "1088",
        "specs_name": "C3.8GB",
        "worker_node": 2,
        "elasticity_dict": {}
    }
]

}

Delete a Kubernetes -

To delete a Kubernetes , send a DELETE request to Kubernetes endpoint :-

https://api.e2enetworks.com/myaccount/api/v1/kubernetes/service/<<id>>?apikey={{api_key}}&location=Delhi&project_id={{project-id}}

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...

Download yml -

To Get a yml file , send a GET request to Kubernetes endpoin :-

https://api.e2enetworks.com/myaccount/api/v1/kubernetes/cluster-config-download/<<<id>>>/?apikey={{api_key}}&project_id={{project-id}}

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    apiVersion: v1
    clusters:
    - cluster:
            certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0t.............
    server: https://216.48.188.36:6443
    name: kubernetes
    contexts:
    - context:
    cluster: kubernetes
    user: kubernetes-admin
    name: kubernetes-admin@kubernetes
    current-context: kubernetes-admin@kubernetes
    kind: Config
    preferences: {}
    users:
    - name: kubernetes-admin
    user:
            client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FUR.............
            client-key-data: LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktL.............
    }

Get Kubernetes Token -

To Get a token , send a GET request to Kubernetes endpoin :-

https://api.e2enetworks.com/myaccount/api/v1/kubernetes/proxy-ui-token/<<<id>>>/?apikey={{api_key}}&project_id={{project-id}}&location=Delhi

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{

    "code": 200,
    "data": {
        "token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjdQRG85NTAwMHJjbi1PVDQ0........"
    },
    "errors": {},
    "message": "Success"

}

List Of Persistent Volume -

To find the list of Persistent Volume , send a GET request to Kubernetes endpoin :-

https://api.e2enetworks.com/myaccount/api/v1/persistent_volume/<<<cluster_id>>>/?apikey={{api_key}}&location=Delhi&project_id={{project-id}}

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{

    "code": 200,
    "data": {
        "pv_list": [
            {
                "pv_id": 368,
                "pv_name": "PV-10GB-375",
                "created_at": "2023-04-04T10:51:59.523136Z",
                "pv_size": 10000,
                "status": "BOUND",
                "cluster_name": "E2E-K8s-Cluster-441",
                "service_id": 4222,
                "cluster_id": 1200
            }
        ],
        "namespace_name": "ns-17976",
        "ceph_user_id": "AQDIHyBjEdhAGxAAHIpRX6dyitUw5rsUeLcG8Q=="
    },
    "errors": {},
    "message": "Success"
}

Create a new Persistent Volume

To create a Persistent Volume , send a Post request :-

https://api.e2enetworks.com/myaccount/api/v1/persistent_volume/<<<cluster_id>>>/?apikey={{api_key}}&location=Delhi

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "name": "PV-10GB-313",
    "pv_size": 10
}

Delete a Persistent Volume -

To delete a Persistent Volume , send a DELETE request to Kubernetes endpoint :-

https://api.e2enetworks.com/myaccount/api/v1/persistent_volume/<<<cluster_id>>>/<<<pv_id>>>/?apikey={{api_key}}&location=Delhi&project_id={{project-id}}

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
"code": 200,
"data": {
    "pv_id": 368
},
"errors": {},
"message": "persistent volume deleted successfully"
}

List Of LB IP Pool -

To find the list of LB IP Pool , send a GET request to Kubernetes endpoin :-

https://api.e2enetworks.com/myaccount/api/v1/reserve_ips/k8s_ip/?apikey={{api_key}}&contact_person_id=null&location=Delhii&project_id={{project-id}}

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "code": 200,
    "data": [
        {
            "ip_address": "216.48.188.6",
            "status": "Available",
            "bought_at": "04-04-2023 11:34",
            "vm_id": null,
            "vm_name": "--",
            "reserve_id": 7157,
            "appliance_type": "--",
            "reserved_type": "KubernetesIP"
        }
    ],
    "errors": {},
    "message": "Success",
    "is_limit_available": true,
    "reserved_ip_details": {
        "customer_max_limit": 3,
        "reserved_ips_count": 2
    },
    "reserve_ip_price": "INR 199.0 (excluding GST)",
    "currency": "INR"
}

Create a new LB IP Pool

To create a LB IP Pool ** , send a **Post request to Kubernetes endpoin :-

https://api.e2enetworks.com/myaccount/api/v1/reserve_ips/k8s_ip/?apikey={{api_key}}&project_id={{project-id}}&location=Delhi

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "code": 200,
    "data": {
        "ip_address": "216.48.188.6",
        "status": "Available",
        "bought_at": "04-04-2023 11:34",
        "vm_id": null,
        "vm_name": "--",
        "reserve_id": 7157,
        "appliance_type": "--",
        "reserved_type": "KubernetesIP"
    },
    "errors": {},
    "message": "Success",
    "is_limit_available": true,
    "reserved_ip_details": {
        "customer_max_limit": 3,
        "reserved_ips_count": 1
    },
    "reserve_ip_price": "INR 199.0 (excluding GST)",
    "currency": "INR"
}

Attach LB IP Pool To Kubernetes

To Attach LB IP Pool To Kubernetes ** , send a **Post request to Kubernetes endpoin :-

https://api.e2enetworks.com/myaccount/api/v1/reserve_ips/k8s_public_ip/<<<ip>>>/actions/?apikey={{api_key}}&project_id={{project-id}}&location=Delhii

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "vm_id": 126334,
    "type": "attach"
}

Detach LB IP Pool To Kubernetes

To detach LB IP Pool To Kubernetes ** , send a **Post request to Kubernetes endpoin :-

https://api.e2enetworks.com/myaccount/api/v1/reserve_ips/k8s_public_ip/<<<ip>>>/actions/?apikey={{api_key}}&project_id={{project-id}}&location=Delhi

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "vm_id": 126334,
    "type": "detach"
}

List Of node Pool

To find the list of node pool , send a GET request to Kubernetes endpoin :-

https://api.e2enetworks.com/myaccount/api/v1/kubernetes/node-pool-services/11381?apikey= {{apikey}}&project_id={{project-id}}&location={{locaiton}}

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "code": 200,
    "data": [
        {
            "service_id": 11383,
            "service_name": "pool-6kfac",
            "roles": [
                {
                    "role_name": "worker",
                    "cardinality": 2,
                    "min_vms": null,
                    "max_vms": null,
                    "cooldown": 60,
                    "state": "Running",
                    "elasticity_policies": [],
                    "scheduled_policies": [],
                    "node_id_list": [
                        197676,
                        197677
                    ]
                }
            ],
            "state": "Running",
            "auto_scale_enabled": false,
            "plan_name": "C3.8GB",
            "version": "1.29",
            "master_node_id": null,
            "created_at": "Jun 06, 2024 04:03:41 PM",
            "cluster_id": 3766,
            "pool_type": "compute",
            "backup_enabled": false,
            "initial_restore_status": "Not restored"
        }
    ],
        "errors": {},
        "message": "Success"
}

Power off worker node

To Power off worker node, send a PUT request:-

https://api.e2enetworks.com/myaccount/api/v1/kubernetes/node-pool-services/11381?apikey={{apikey}}&project_id={{project-id}}&location={{locaiton}}

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "code": 200,
    "data": {},
    "errors": {},
    "message": "power_off Action Successfully Performed on Node e2e-117-53"
}

Reboot worker node

To Reboot worker node, send a PUT request:-

https://api.e2enetworks.com/myaccount/api/v1/kubernetes/node-pool/11383/update-worker-node/183302/?action=reboot&apikey={{apikey}}&project_id={{project-id}}&location={{locaiton}}

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "code": 200,
    "data": {},
    "errors": {},
    "message": "reboot Action Successfully Performed on Node e2e-117-65"
}

Delete worker node

To Delete a worker node, send a DELETE request:-

https://api.e2enetworks.com/myaccount/api/v1/kubernetes/delete-worker-node/11383/183302/?apikey= {{apikey}}&project_id={{project-id}}&location={{locaiton}}

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "code": 200,
    "data": {},
    "errors": {},
    "message": "node deleted successfully"
}

Market Place

To get Market Place details, send a GET request:-

https://api.e2enetworks.com/myaccount/api/v1/kubernetes/available-tools/11381/?apikey={{apikey}}&project_id={{project-id}}&location={{locaiton}}

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "code": 200,
    "data": [
        {
            "id": 1,
            "name": "Monitoring Stack",
            "description": "Prometheus is an open-source monitoring and alerting tool. It is designed to collect metrics from different sources, store them efficiently, and enable querying and visualization of these metrics for monitoring purposes.",
            "type": "Monitoring Tools",
            "status": "not-installed",
            "error_message": null
        },
        {
            "id": 2,
            "name": "Cert-Manager",
            "description": "Cert Manager is an open-source Kubernetes-native certificate management controller. It helps automate the management and provisioning of SSL/TLS certificates for applications running on Kubernetes clusters.",
            "type": "Network Tools",
            "status": "not-installed",
            "error_message": null
        },
        {
            "id": 3,
            "name": "NGINX Ingress Controller",
            "description": "",
            "type": "Network Tools",
            "status": "not-installed",
            "error_message": null
        }
    ],
            "errors": {},
            "message": "Success"
}

Monitoring

To get Monitoring details, send a GET request:-

https://api.e2enetworks.com/myaccount/api/v1/kubernetes/k8s-monitoring-nodes/11381/?apikey={{apikey}}&project_id={{project-id}}&location={{locaiton}}

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "code": 200,
    "data": [
        {
            "id": 183298,
            "name": "master_0_service_11381",
            "vm_id": 197673,
            "created_at": "2024-06-06T10:29:34.651904Z",
            "public_ip_address": "116.204.172.41",
            "private_ip_address": "10.11.244.6",
            "backup": false,
            "disk": null,
            "status": "Running",
            "vcpus": null,
            "memory": null,
            "plan": "",
            "zabbix_host_id": null,
            "gpu": "NA",
            "price": "",
            "label": "Default",
            "is_active": true,
            "scaler_id": 11381,
            "is_monitored": true,
            "location": "Delhi",
            "monitor_status": {
                "status": "activated",
                "reason": ""
            },
            "is_committed": false,
            "audit_log_message": null,
            "monitoring_tab_enabled": true,
            "alert_tab_enabled": true,
            "is_image_deleted": false,
            "vpc_enabled": true,
            "rescue_mode_status": "Disabled",
            "is_upgradable": null,
            "abuse_flag": false,
            "vm_type": "master",
            "worker_name": "onekube-ip-10-11-244-6"
        },
        {
            "id": 183301,
            "name": "worker_0_service_11383",
            "vm_id": 197676,
            "created_at": "2024-06-06T10:38:05.979651Z",
            "public_ip_address": "116.204.172.53",
            "private_ip_address": "10.11.244.7",
            "backup": false,
            "disk": null,
            "status": "Running",
            "vcpus": null,
            "memory": null,
            "plan": "",
            "zabbix_host_id": null,
            "gpu": "NA",
            "price": "",
            "label": "Default",
            "is_active": true,
            "scaler_id": 11383,
            "is_monitored": true,
            "location": "Delhi",
            "monitor_status": {
                "status": "activated",
                "reason": ""
            },
            "is_committed": false,
            "audit_log_message": null,
            "monitoring_tab_enabled": true,
            "alert_tab_enabled": true,
            "is_image_deleted": false,
            "vpc_enabled": false,
            "rescue_mode_status": "Disabled",
            "is_upgradable": null,
            "abuse_flag": false,
            "vm_type": "worker",
            "worker_name": "e2e-117-53"}
}