Kubernetes Clusters
This chapter describes details about the resource “kubeclusters” which represents client Kubernetes clusters managed by CloudCasa.
Note
The samples shown in the following sections may not be exhaustive. In particular, some headers might have been skipped for the sake of brevity.
Registering a Kubernetes Cluster
Create a kubecluster resource by doing POST. For details, see Create a Cluster resource.
At this point, the cluster is in “REGISTERED” state and is waiting for the user to apply the yaml file (which installs a lightweight agent).
Apply the agent YAML, like so:
$ kubectl apply -f \
https://<CC-SERVER-NAME-OR-IP>/kubeclusteragents/agent-gpq6w/RiFmKE3W1zgeIZACmTA8Z-iZrKXcdM0jEC7RiCu0lT4=.yaml
This starts “kubemanager” pod (in cloudcasa-io namespace) which will connect to CloudCasa server and fetches few resources, including “kubeagent”. You will see “kubeagent” pod coming up at this time and the cluster should eventually move to “ACTIVE” state.
Create a Cluster resource
POST /api/v1/kubeclusters
{
"name": "testcluster",
"description": "Created for testing purposes",
"tags": {
"testkey": "testval"
},
"image_pull_secret_name": "<PULL-SECRET-NAME>",
"container_registry": "<CONTAINER-REGISTRY-URL>"
}
HTTP/1.1 201 CREATED
Location: http://<CC-SERVER-NAME-OR-IP>/api/v1/v1/kubeclusters/5eb599e603f7a77d5223efee
{
"_created": "Fri, 08 May 2020 17:41:58 GMT",
"_etag": "27114931c62a2ea2f7f2fd21c4c8f62ba7b55a0c",
"_id": "5eb599e603f7a77d5223efee",
"_links": {
"self": {
"href": "/v1/kubeclusters/5eb599e603f7a77d5223efee",
"title": "Kubecluster"
}
},
"_status": "OK",
"_updated": "Fri, 08 May 2020 17:41:58 GMT",
"description": "Created for testing purposes",
"tags": {
"testkey": "testval"
},
"name": "testcluster",
"image_pull_secret_name": "myregistrykey",
...
}
Input Spec
- name
Name of the cluster. Required.
- image_pull_secret_name
Optional. This is the name of the “secret” that is needed to pull images. Users should create this secret in the “cloudcasa-io” namespace before registering the cluster.
- container_registry
Optional. URL of the container registry from where images will be pulled. The list of images is available under
https://<CC-SERVER-NAME-OR-IP>/api/v1/v1/kubeclusters/cloudcasa-images
.- kublet_pods_dir
Optional. The base path where CloudCasa will look for pod PV data when “LIVE_FROM_HOST_POD_VOL” has been selected for a PV backup operation on the cluster. Defaults to “/var/lib/kubelet/pods”.
- backup_provider
Optional. Object. Set this field to configure the default backup storage location for the cluster. Note that this default location can be overwritten on a per-backup basis. If not specified, CloudCasa will use backup storage location specified at the organization level.
- type
Optional. Supported only in SaaS. Required when
backup_provider.region
is set. Allowed values:aws
andazure
.- region
Optional. Supported only in SaaS. Required when
backup_provider.type
is set. A valid AWS/Azure region.- user_objectstore
Optional. ID of the object store created by the user. For more details see User Storage
- description
Optional. Helpful text to identify the cluster.
- tags
Optional. Key value pairs.
Getting a cluster resource
GET /api/v1/kubeclusters/5eb599e603f7a77d5223efee
HTTP/1.1 200 OK
Listing Clusters
GET /api/v1/kubeclusters
Updating Cluster
PATCH /api/v1/kubeclusters/5eb599e603f7a77d5223efee
If-Match: 27114931c62a2ea2f7f2fd21c4c8f62ba7b55a0c
{
"name": "newname",
"description": "New description"
}
HTTP/1.1 200 OK
<Full Resource>
It is also possible to do a PUT which requires entire resource to be sent in the request body. See “Overview” for some details in this regard.
“If-Match” header is required.
Deleting a cluster resource
DELETE /api/v1/kubeclusters/5eb599e603f7a77d5223efee
If-Match: 27114931c62a2ea2f7f2fd21c4c8f62ba7b55a0c
HTTP/1.1 204 NO CONTENT
Deletion of a cluster fails if there is a backup definition for it, or otherwise being used in any other way.
Notes
Once the cluster resource is deleted, users should remove CloudCasa components from their clusters. This can be done by removing the namespace
cloudcasa-io
.