Skip to content

Clusters

Clusters and workloads are deployed in the Customer's Org in the context of a Project. Users can use RCTL to fully automate the lifecycle management of clusters. Specifically, the operations listed in the table below can be fully automated using RCTL.

Resource Create Get Update Delete
Cluster YES YES YES YES

Create/Update Cluster

Declarative

Use the below to create/update a cluster in your project. You can also import a cluster into the Project based on a version controlled cluster spec that you can store in a Git repository. This enables users to develop automation for reproducible infrastructure.

./rctl apply -f cluster-spec.yml

An illustrative example of the cluster spec YAML file is shown below

kind: Cluster
metadata:
  # set the name of the cluster
  name: demo-imported-cluster-01
  # specific the project name to create the cluster
  project: defaultproject
  # cluster labels
  labels:
    env: dev
    type: ml-workloads
spec:
  # type can be "imported"
  type: imported
  # location, can be custom or predefined
  location: aws/eu-central-1
  # blueprint below is optional, if not specified, default value is "default"
  blueprint: default
  # blueprintversion below is optional, if not specified, latest version in the blueprint will be used"
  blueprintversion: v1

Below is an example of cluster unified yaml spec

apiVersion: infra.k8smgmt.io/v3
kind: Cluster
metadata:
  name: demo-cluster
  project: default
spec:
  blueprintConfig:
    name: demo-bp
    version: v1
  cloudCredentials: demo_aws
  config:
    managedNodeGroups:
    - amiFamily: AmazonLinux2
      desiredCapacity: 1
      iam:
        withAddonPolicies:
          autoScaler: true
      instanceType: t3.xlarge
      maxSize: 2
      minSize: 0
      name: managed-ng-1
      version: "1.22"
      volumeSize: 80
      volumeType: gp3
    metadata:
      name: demo-cluster
      region: us-west-2
      version: "1.22"
    network:
      cni:
        name: aws-cni
        params:
          customCniCrdSpec:
            us-west-2a:
            - securityGroups:
              - sg-09706d2348936a2b1
              subnet: subnet-0f854d90d85509df9
            us-west-2b:
            - securityGroups:
              - sg-09706d2348936a2b1
              subnet: subnet-0301d84c8b9f82fd1
    vpc:
      clusterEndpoints:
        privateAccess: false
        publicAccess: true
      nat:
        gateway: Single
      subnets:
        private:
          subnet-06e99eb57fcf4f117:
            id: subnet-06e99eb57fcf4f117
          subnet-0509b963a387f7fc7:
            id: subnet-0509b963a387f7fc7
        public:
          subnet-056b49f76124e37ec:
            id: subnet-056b49f76124e37ec
          subnet-0e8e6d17f6cb05b29:
            id: subnet-0e8e6d17f6cb05b29
  proxyConfig: {}
  type: aws-eks

List Clusters

Use this command to retrieve the list of clusters available in the configured project. In the example shown below, there are four clusters in this project.

./rctl get cluster

+--------------------------------+----------+
|              NAME              |   TYPE   |
+--------------------------------+----------+
| rafaypoc-eks-existing-vpc-cicd | aws-eks  |
| demo-spot-eks                  | aws-eks  |
| demo-vmware-sjc                | manual   |
| demo-aks-east                  | imported |
+--------------------------------+----------+

Get Cluster Info

Use this command to retrieve the a specific cluster available in the configured project.

./rctl get cluster <cluster-name>

Below is the illustrative example of the "demo-spot-eks" cluster information of the current project:

./rctl get cluster demo-spot-eks

+---------------+-----------------------------+-----------------------------+---------+--------+---------------+
|     NAME      |         CREATED AT          |         MODIFIED AT         |  TYPE   | STATUS |   BLUEPRINT   |
+---------------+-----------------------------+-----------------------------+---------+--------+---------------+
| demo-spot-eks | 2020-08-11T16:54:25.750659Z | 2020-09-23T04:05:00.720032Z | aws-eks | READY  | eks-blueprint |
+---------------+-----------------------------+-----------------------------+---------+--------+---------------+
Or you can use below command to get more cluster information in json or yaml format

./rctl get cluster <cluster-name> -o json
./rctl get cluster <cluster-name> -o yaml


Delete Cluster

Authorized users can automate the deletion of an existing cluster in the configured project using RCTL.

./rctl delete cluster <cluster-name>

Download Cluster Spec

Users can download the declarative specification (config) for their cluster from the controller using the command below.

./rctl get cluster config <cluster name> -o yaml

Download Kubeconfig

Users can use RCTL to download the Kubeconfig for clusters in the configured project. All access will be performed via the Controller's Zero Trust Kubectl access proxy.

./rctl download kubeconfig [flags]

By default, a unified Kubeconfig for all clusters in the project is downloaded. If required, users can download the Kubeconfig for a selected cluster.

./rctl download kubeconfig --cluster <cluster-name>

Refer here for the deprecated RCTL commands