A machine-readable index of this documentation for AI agents is available at https://kubevela.io/llms.txt. Markdown versions of documentation pages are available by appending .md to their URLs.
Skip to main content
Version: v1.9

Lifecycle of Managed Cluster

This section will introduce the lifecycle of managed clusters.

Create 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:

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

Join Clusters​

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

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:

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

List clusters​

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

$ vela cluster list
CLUSTER ALIAS TYPE ENDPOINT ACCEPTED LABELS
local Internal - true
beijing X509Certificate <ENDPOINT_BEIJING> true
hangzhou-1 X509Certificate <ENDPOINT_HANGZHOU_1> true
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.

Label your cluster​

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

$ vela cluster labels add hangzhou-1 region=hangzhou
$ vela cluster labels add hangzhou-2 region=hangzhou
$ vela cluster list
CLUSTER ALIAS TYPE ENDPOINT ACCEPTED LABELS
local Internal - true
beijing X509Certificate <ENDPOINT_BEIJING> true
hangzhou-1 X509Certificate <ENDPOINT_HANGZHOU_1> true region=hangzhou
hangzhou-2 X509Certificate <ENDPOINT_HANGZHOU_2> true region=hangzhou

Detach your cluster​

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

$ vela cluster detach beijing

Detaching deletes the cluster's credentials. What KubeVela deployed there keeps running, but KubeVela can no longer reach it: deleting an Application can't clean up its resources there, and Applications that still place to the cluster fail their deploy step. Check nothing is deployed there first: kubectl get resourcetrackers -o json | jq -r '.items[] | select(any(.spec.managedResources[]?; .cluster == "<cluster>")) | .metadata.name'

Rename a cluster​

This command can rename cluster managed by KubeVela.

$ vela cluster rename cluster-prod cluster-production

Next​