Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce new command to generate kubeconfig #226

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

gianlucam76
Copy link
Member

sveltosctl generate kubeconfig --help
Usage:
  sveltosctl generate kubeconfig [options] [--namespace=<name>] [--serviceaccount=<name>] [--create] [--verbose]

     --namespace=<name>      The namespace of the ServiceAccount. If not specified, projectsveltos namespace will be used.
     --serviceaccount=<name> The name of the ServiceAccount. If not specified, projectsveltos will be used.
     --create                If a ServiceAccount with enough permissions is already present, do not set this flag.
                             Sveltos will generate a Kubeconfig associated to that ServiceAccount.
                             If a ServiceAccount with cluster admin permissions needs to be created, use this option.
                             When this option is set, this command will create necessary resources:
                             1. namespace if not existing already
                             2. serviceAccount if not existing already
                             3. ClusterRole with cluster admin permission
                             4. ClusterRoleBinding granting the serviceAccount cluster admin permissions
                             5. TokenRequest for the ServiceAccount

Options:
  -h --help                  Show this screen.
     --verbose               Verbose mode. Print each step.

Description:
  The generate kubeconfig command will generate a Kubeconfig that can later on be used to register the cluster.

This PR removes the sveltosctl register mgmt-cluster

To register the management cluster with Sveltos, simply

  1. run sveltosctl generate kubeconfig ... against the management cluster
  2. run sveltosctl register cluster ... using the Kubeconfig generated in the previous step

```
sveltosctl generate kubeconfig --help
Usage:
  sveltosctl generate kubeconfig [options] [--namespace=<name>] [--serviceaccount=<name>] [--create] [--verbose]

     --namespace=<name>      The namespace of the ServiceAccount. If not specified, projectsveltos namespace will be used.
     --serviceaccount=<name> The name of the ServiceAccount. If not specified, projectsveltos will be used.
     --create                If a ServiceAccount with enough permissions is already present, do not set this flag.
                             Sveltos will generate a Kubeconfig associated to that ServiceAccount.
                             If a ServiceAccount with cluster admin permissions needs to be created, use this option.
                             When this option is set, this command will create necessary resources:
                             1. namespace if not existing already
                             2. serviceAccount if not existing already
                             3. ClusterRole with cluster admin permission
                             4. ClusterRoleBinding granting the serviceAccount cluster admin permissions
                             5. TokenRequest for the ServiceAccount

Options:
  -h --help                  Show this screen.
     --verbose               Verbose mode. Print each step.

Description:
  The generate kubeconfig command will generate a Kubeconfig that can later on be used to register the cluster.
```
@gianlucam76 gianlucam76 merged commit 3242be3 into projectsveltos:dev Apr 11, 2024
2 checks passed
@gianlucam76 gianlucam76 deleted the token branch April 11, 2024 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant