API
A set of comprehensive APIs are available that enable the users to seamlessly create, update, retrieve cluster details (list, and status) and delete V3 MKS Clusters. The API allows you to easily manage the cluster by providing the project id and resource name
Create Cluster¶
To create a new cluster (or) update an existing cluster config in a specific project:
- Provide the project name and the new/updated schema for the resource
- Click Execute
Below is an example of a cluster schema updating the blueprint to 'default'.
Cluster List¶
To view the list of clusters in a specific project, provide the project name and click execute. Below is an example of the cluster list output:
Get Cluster Installer Command¶
The Get Cluster InstallerCmds API endpoint returns a command that needs to be executed on MKS nodes. This command facilitates the discovery and integration of these nodes with Rafay's platform. This serves as a setup wizard to configure nodes for management and operations via Rafay's infrastructure. After obtaining this command from the API, it should be copied and executed on each customer node to enable communication with Rafay's services.
To get the installer command, - Provide the project name and cluster name - Click Execute
Below is an example of the output that shows the command for arm64 with OSFamily linux.
Scroll down to get the command for amd64 with OSFamily linux.
Cluster Details¶
To retrieve a cluster details from a specific project:
- Provide the project name and the cluster name
- Click Execute
Below is the output of this execution:
{
"apiVersion": "infra.k8smgmt.io/v3",
"kind": "Cluster",
"metadata": {
"name": "demo-cluster",
"project": "defaultproject",
"modifiedAt": "2024-06-24T14:41:57.051572Z"
},
"spec": {
"type": "mks",
"config": {
"location": "sanjose-us",
"autoApproveNodes": true,
"kubernetesVersion": "v1.28.9",
"network": {
"cni": {
"name": "Calico",
"version": "3.26.1"
},
"podSubnet": "10.244.0.0/16",
"serviceSubnet": "10.96.0.0/12"
},
"nodes": [
{
"hostname": "ap-node1",
"operatingSystem": "Ubuntu22.04",
"arch": "amd64",
"privateIP": "10.0.0.93",
"roles": [
"Worker",
"ControlPlane"
],
"labels": {
"app": "infra"
},
"ssh": {
"privateKeyPath": "/Users/user1/Desktop/ocikeys/mks2.pem",
"username": "ubuntu",
"port": "22",
"ipAddress": "158.101.45.62"
}
}
]
},
"blueprint": {
"name": "default"
}
}
}
Cluster Status¶
To view the status of a cluster from a specific project:
- Provide the project name and the cluster name
- Click Execute
The output contains the cluster configuration along with the statuses of the provision, cluster conditions, task sets, and node status.
"status": {
"id": "pd270k4",
"name": "demo-mkscluster",
"displayName": "demo-mkscluster",
"createdAt": "2024-06-24T08:23:38Z",
"conditions": [
{
"type": "ClusterRegisterSucceeded",
"status": "True",
"reason": "registered"
},
{
"type": "ClusterCheckInSucceeded",
"status": "True",
"reason": "checked in"
},
{
"type": "ClusterNodeSyncSucceeded",
"status": "True",
"reason": "all nodes synced"
},
{
"type": "ClusterNamespaceSyncSucceeded",
"status": "True",
"reason": "all namespaces synced"
},
{
"type": "ClusterBlueprintSyncSucceeded",
"status": "True",
"reason": "all tasks/workloads synced"
},
{
"type": "ClusterReady",
"status": "True",
"reason": "blueprint synced"
}
],
"extra": {
"vaultIntegration": {}
},
"blueprint": {
"name": "default"
},
"provisionStatus": "CLUSTER_PROVISION_COMPLETE",
"commonStatus": {
"conditionType": "ClusterOperationApplied",
"conditionStatus": 2,
"lastUpdated": {
"seconds": 1719240117,
"nanos": 51572000
},
"reason": "clusterOperation is applied"
},
"lastTasksets": [
{
"tasksetId": "lk5xw2e",
"tasksetOperations": [
{
"operationName": "ClusterUpgrade",
"resourceName": "demo-mkscluster",
"operationStatus": "PROVISION_TASK_STATUS_SUCCESS"
}
],
"tasksetStatus": "PROVISION_TASKSET_STATUS_COMPLETE",
"comments": "Configuration is applied to the cluster successfully"
},
{
"tasksetId": "yemp028",
"tasksetOperations": [
{
"operationName": "ClusterCreation",
"resourceName": "demo-mkscluster",
"operationStatus": "PROVISION_TASK_STATUS_SUCCESS"
},
{
"operationName": "BlueprintSync",
"resourceName": "demo-mkscluster",
"operationStatus": "PROVISION_TASK_STATUS_PENDING"
}
],
"tasksetStatus": "PROVISION_TASKSET_STATUS_COMPLETE",
"comments": "Configuration is applied to the cluster successfully"
}
],
"mks": {
"nodes": [
{
"hostname": "ap-node1",
"status": "READY"
}
]
}
}
}
Cluster Delete¶
To delete a cluster from a specific project:
- Provide the project name and name of the resource
- Click Execute
Node Actions¶
To cordon, uncordon, or drain a node from a specific cluster:
- Provide the project name and node name
- Select the desired action (cordon, uncordon, or drain) from the drop-down
- Provide the cluster name and click Execute
By default, the drain value is set to 'true', but users can modify it as needed. This operation only applies if the action selected is drain; otherwise, it will be ignored for other actions.