(feat) Register cluster: add option to pass shard key#429
Merged
gianlucam76 merged 1 commit intoprojectsveltos:mainfrom May 5, 2026
Merged
Conversation
```bash
Usage:
sveltosctl register cluster [options] --namespace=<name> --cluster=<name> [--kubeconfig=<file>] [--fleet-cluster-context=<value>] [--pullmode]
[--labels=<value>] [--shard=<key>] [--service-account-token] [--verbose]
--namespace=<name> Specifies the namespace where Sveltos will create a resource (SveltosCluster) to represent
the registered cluster.
--cluster=<name> Defines a name for the registered cluster within Sveltos.
--kubeconfig=<file> (Optional) Provides the path to a file containing the kubeconfig for the Kubernetes cluster
you want to register.
If you don't have a kubeconfig file yet, you can use the "sveltosctl generate kubeconfig"
command.
Be sure to point that command to the specific cluster you want to manage.
This will help you create the necessary kubeconfig file before registering the cluster
with Sveltos.
Either --kubeconfig or --fleet-cluster-context must be provided.
--fleet-cluster-context=<value> (Optional) If your kubeconfig has multiple contexts:
- One context points to the management cluster (default one)
- Another context points to the cluster you actually want to manage;
In this case, you can specify the context name with the --fleet-cluster-context flag.
This tells the command to use the specific context to generate a Kubeconfig Sveltos
can use and then create a SveltosCluster with it so you don't have to provide kubeconfig
Either --kubeconfig or --fleet-cluster-context must be provided.
--pullmode (Optional) this registers a cluster in pull mode. When enabled, the managed cluster will actively
fetch its configurations from the management cluster, which is ideal for scenarios with
firewall restrictions or when direct inbound access to the managed cluster is undesirable.
This flag outputs the specialized YAML configuration that needs to be applied to the managed
cluster to complete its setup.
--labels=<key1=value1,key2=value2> (Optional) This option allows you to specify labels for the SveltosCluster resource
being created. The format for labels is <key1=value1,key2=value2>, where each key-value
pair is separated by a comma (,) and the key and value are separated by an equal sign (=).
You can define multiple labels by adding more key-value pairs separated by commas.
--shard=<shard key> Optional. Assigns the cluster to a specific controller shard. This automatically adds the annotation
sharding.projectsveltos.io/key: <value> to the SveltosCluster resource, ensuring the correct shard
processes it.
--service-account-token (Optional) Use a non-expiring ServiceAccount token for management cluster registration.
When enabled, Sveltos will automatically create the necessary ServiceAccount infrastructure
(ServiceAccount, ClusterRole, and ClusterRoleBinding) in the managed cluster and
generate a long-lived token by also creating a Secret of type kubernetes.io/service-account-token.
```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #428