Version: v1.8

Lifecycle of Managed Cluster

This section will introduce the lifecycle of managed clusters.

KubeVela can generally adopt any Kubernetes cluster as managed cluster, the control plane won’t install anything to your managed cluster unless you have enable any addons.

If you don’t have any clusters, you can refer to VelaD to create one for demo:

  1. velad install --name <cluster-name> --cluster-only

You can simply join an existing cluster into KubeVela by specifying its KubeConfig as below

  1. vela cluster join <your kubeconfig path>

It will use the field context.cluster in KubeConfig as the cluster name automatically, you can also specify the name by --name parameter. For example:

  1. $ vela cluster join beijing.kubeconfig --name beijing
  2. $ vela cluster join hangzhou-1.kubeconfig --name hangzhou-1
  3. $ vela cluster join hangzhou-2.kubeconfig --name hangzhou-2

After clusters joined, you could list all clusters managed by KubeVela.

  1. $ vela cluster list
  2. CLUSTER TYPE ENDPOINT ACCEPTED LABELS
  3. local Internal - true
  4. cluster-beijing X509Certificate <ENDPOINT_BEIJING> true
  5. cluster-hangzhou-1 X509Certificate <ENDPOINT_HANGZHOU_1> true
  6. cluster-hangzhou-2 X509Certificate <ENDPOINT_HANGZHOU_2> true

By default, the hub cluster where KubeVela locates is registered as the local cluster. You can use it like a managed cluster in spite that you cannot detach it or modify it.

You can also give labels to your clusters, which helps you select clusters for deploying applications.

  1. $ vela cluster labels add cluster-hangzhou-1 region=hangzhou
  2. $ vela cluster labels add cluster-hangzhou-2 region=hangzhou
  3. $ vela cluster list
  4. CLUSTER TYPE ENDPOINT ACCEPTED LABELS
  5. local Internal - true
  6. cluster-beijing X509Certificate <ENDPOINT_BEIJING> true
  7. cluster-hangzhou-1 X509Certificate <ENDPOINT_HANGZHOU_1> true region=hangzhou
  8. cluster-hangzhou-2 X509Certificate <ENDPOINT_HANGZHOU_2> true region=hangzhou

You can also detach a cluster if you do not want to use it anymore.

  1. $ vela cluster detach beijing

It is dangerous to detach a cluster that is still in-use. But if you want to do modifications to the held cluster credential, like rotating certificates, it is possible to do so.

This command can rename cluster managed by KubeVela.

  1. $ vela cluster rename cluster-prod cluster-production

Last updated on May 6, 2023 by Tianxin Dong