Skip to main content

Add a cluster using credentials

Contributors dmp-netapp netapp-aoife

You can add a cluster so it will be available to be managed by Astra. Beginning with the Astra 22.11 release, you can add a cluster with both Astra Control Center and Astra Control Service.

Note Adding a cluster is not required when using a Kubernetes service from one of the major cloud providers (AKS, EKS, GKE).

Step 1: Obtain the kubeconfig file

You need to obtain a copy of the kubconfig file from your Kubernetes administrator or service.

Step 2: Prepare the kubeconfig file

Before using the kubeconfig file, you should perform the following operations:

  1. Convert file from YAML format to JSON:

    If you receive the kubeconfig file formatted as YAML, you need to convert it to JSON.

  2. Encode JSON in base64:

    You must encode the JSON file in base64.

Example

Here is an example of converting the kubeconfig file from YAML to JSON and then encoding it in base64:

yq -o=json ~/.kube/config | base64

Step 3: Select the cloud

Perform the workflow List the clouds and select the cloud where the cluster will be added.

Note The only cloud you can select is the private cloud.

Step 4: Create a credential

Perform the following REST API call to create a credential using the kubeconfig file.

HTTP method and endpoint

This REST API call uses the following method and endpoint.

HTTP method Path

POST

/accounts/{account_id}/core/v1/credentials

Curl example
curl --request POST \
--location "https://astra.netapp.io/accounts/$ACCOUNT_ID/core/v1/credentials" \
--include \
--header "Accept: */*" \
--header "Authorization: Bearer $API_TOKEN" \
--data  @JSONinput
JSON input example
{
  "type" :  "application/astra-credential",
  "version" : "1.1",
  "name" : "Cloud One",
  "keyType" : "kubeconfig",
  "keyStore" : {
    "base64": encoded_kubeconfig
  },
  "valid" : "true"
}

Step 5: Add the cluster

Perform the following REST API call to add the cluster to the cloud. The value of the credentialID input field is obtained from the REST API call in the previous step.

HTTP method and endpoint

This REST API call uses the following method and endpoint.

HTTP method Path

POST

/accounts/{account_id}/topology/v1/clouds/{cloud_id}/clusters

Curl example
curl --request POST \
--location "https://astra.netapp.io/accounts/$ACCOUNT_ID/topology/v1/clouds/<CLOUD_ID>/clusters" \
--include \
--header "Accept: */*" \
--header "Authorization: Bearer $API_TOKEN" \
--data  @JSONinput
JSON input example
{
  "type" :  "application/astra-cluster",
  "version" : "1.1",
  "credentialID": credential_id
}