Feedback

Chat Icon

End-to-End Kubernetes with Rancher, RKE2, K3s, Fleet, Longhorn, and NeuVector

The full journey from nothing to production

Fleet: Multi-Tenant Cluster Management & Workspaces
49%

Cluster Groups: Logical Grouping of Clusters

Fleet excels in multi-cluster management by allowing users to group clusters logically using ClusterGroups. These groups enable the application of workloads to multiple clusters simultaneously using a single target and therefore simplify operations across large-scale environments. Clusters can be selected for inclusion in a ClusterGroup based on labels or other metadata. For example, you can label clusters with environment names like staging or production and use these labels to group clusters into ClusterGroups.

You can, if you want to test this, add any label to the RKE2 cluster:

# SSH into the Workspace node
ssh root@$WORKSPACE_PUBLIC_IP

# Get the RKE2 cluster name
# You should see the local cluster and the RKE2 cluster
kubectl -n cattle-system get \
  clusters.management.cattle.io

# Add a label to the RKE2 cluster
# Replace  with the actual cluster name
# You can change the label key and value to suit your needs.
kubectl -n cattle-system label \
  clusters.management.cattle.io \
   env=learning

Using Fleet dashboard you can create one or more ClusterGroup objects based on labels:

Cluster Group

Cluster Group

Now, you can create a GitRepo resource that targets multiple clusters using the ClusterGroup:

# First, delete the previous GitRepo if it exists
kubectl delete gitrepo todo-app-gitrepo -n fleet-default --ignore-not-found

# Make sure no resources are left from the previous deployment
kubectl delete namespace todo-app-namespace --force --grace-period=0 --ignore-not-found

# Delete any orphaned resources if needed
kubectl api-resources --verbs=list --namespaced -o name | \
  xargs -n 1 kubectl delete --all -n todo-app-namespace --force --grace-period=0

# Create a GitRepo that targets the learning-clusters-group
cat <
---
apiVersion: fleet.cattle.io/v1alpha1
kind:

End-to-End Kubernetes with Rancher, RKE2, K3s, Fleet, Longhorn, and NeuVector

The full journey from nothing to production

Enroll now to unlock all content and receive all future updates for free.