Skip to content

Implement multi-cluster support for kubectl commands#45

Open
MAVRICK-1 wants to merge 1 commit into
kubestellar:mainfrom
MAVRICK-1:feat/multi-cluster-kubectl-support
Open

Implement multi-cluster support for kubectl commands#45
MAVRICK-1 wants to merge 1 commit into
kubestellar:mainfrom
MAVRICK-1:feat/multi-cluster-kubectl-support

Conversation

@MAVRICK-1
Copy link
Copy Markdown

@MAVRICK-1 MAVRICK-1 commented Aug 16, 2025

This pull request introduces significant improvements to the build system and documentation, and adds a new standalone CLI entry point for KubeStellar. The changes split the project into two binaries: a kubectl plugin (kubectl-multi) and a standalone CLI (kubestellar). The Makefile is refactored to support building, installing, and developing both binaries independently or together. The README.md is extensively rewritten to reflect the new dual-CLI architecture, provide detailed usage instructions, and enhance clarity for users and contributors. Additionally, a new main entry point for the standalone CLI is added.

Key changes:

Build System and Makefile Refactoring

  • Refactored the Makefile to support building, installing, and developing both the kubectl-multi plugin and the new kubestellar standalone CLI, with separate targets for each binary and combined targets for both. [1] [2] [3]

Standalone CLI Addition

  • Added a new entry point at cmd/kubestellar/main.go for the standalone kubestellar CLI, which initializes the CLI using the shared command package.

Documentation Overhaul

  • Completely rewrote and reorganized README.md to document both the plugin and standalone CLI, including installation, usage, architecture, commands, configuration, example outputs, development instructions, and support resources.

These changes collectively modernize the project structure, improve developer and user experience, and lay the groundwork for future enhancements.

Fixes #44

- Added  command to retrieve resources from all managed clusters with unified output.
- Introduced The Kubernetes package manager

Common actions for Helm:

- helm search:    search for charts
- helm pull:      download a chart to your local directory to view
- helm install:   upload the chart to Kubernetes
- helm list:      list releases of charts

Environment variables:

| Name                               | Description                                                                                                |
|------------------------------------|------------------------------------------------------------------------------------------------------------|
| $HELM_CACHE_HOME                   | set an alternative location for storing cached files.                                                      |
| $HELM_CONFIG_HOME                  | set an alternative location for storing Helm configuration.                                                |
| $HELM_DATA_HOME                    | set an alternative location for storing Helm data.                                                         |
| $HELM_DEBUG                        | indicate whether or not Helm is running in Debug mode                                                      |
| $HELM_DRIVER                       | set the backend storage driver. Values are: configmap, secret, memory, sql.                                |
| $HELM_DRIVER_SQL_CONNECTION_STRING | set the connection string the SQL storage driver should use.                                               |
| $HELM_MAX_HISTORY                  | set the maximum number of helm release history.                                                            |
| $HELM_NAMESPACE                    | set the namespace used for the helm operations.                                                            |
| $HELM_NO_PLUGINS                   | disable plugins. Set HELM_NO_PLUGINS=1 to disable plugins.                                                 |
| $HELM_PLUGINS                      | set the path to the plugins directory                                                                      |
| $HELM_REGISTRY_CONFIG              | set the path to the registry config file.                                                                  |
| $HELM_REPOSITORY_CACHE             | set the path to the repository cache directory                                                             |
| $HELM_REPOSITORY_CONFIG            | set the path to the repositories file.                                                                     |
| $KUBECONFIG                        | set an alternative Kubernetes configuration file (default "~/.kube/config")                                |
| $HELM_KUBEAPISERVER                | set the Kubernetes API Server Endpoint for authentication                                                  |
| $HELM_KUBECAFILE                   | set the Kubernetes certificate authority file.                                                             |
| $HELM_KUBEASGROUPS                 | set the Groups to use for impersonation using a comma-separated list.                                      |
| $HELM_KUBEASUSER                   | set the Username to impersonate for the operation.                                                         |
| $HELM_KUBECONTEXT                  | set the name of the kubeconfig context.                                                                    |
| $HELM_KUBETOKEN                    | set the Bearer KubeToken used for authentication.                                                          |
| $HELM_KUBEINSECURE_SKIP_TLS_VERIFY | indicate if the Kubernetes API server's certificate validation should be skipped (insecure)                |
| $HELM_KUBETLS_SERVER_NAME          | set the server name used to validate the Kubernetes API server certificate                                 |
| $HELM_BURST_LIMIT                  | set the default burst limit in the case the server contains many CRDs (default 100, -1 to disable)         |
| $HELM_QPS                          | set the Queries Per Second in cases where a high number of calls exceed the option for higher burst values |

Helm stores cache, configuration, and data based on the following configuration order:

- If a HELM_*_HOME environment variable is set, it will be used
- Otherwise, on systems supporting the XDG base directory specification, the XDG variables will be used
- When no other location is set a default location will be used based on the operating system

By default, the default directories depend on the Operating System. The defaults are listed below:

| Operating System | Cache Path                | Configuration Path             | Data Path               |
|------------------|---------------------------|--------------------------------|-------------------------|
| Linux            | $HOME/.cache/helm         | $HOME/.config/helm             | $HOME/.local/share/helm |
| macOS            | $HOME/Library/Caches/helm | $HOME/Library/Preferences/helm | $HOME/Library/helm      |
| Windows          | %TEMP%\helm               | %APPDATA%\helm                 | %APPDATA%\helm          |

Usage:
  helm [command]

Available Commands:
  completion  generate autocompletion scripts for the specified shell
  create      create a new chart with the given name
  dependency  manage a chart's dependencies
  env         helm client environment information
  get         download extended information of a named release
  help        Help about any command
  history     fetch release history
  install     install a chart
  lint        examine a chart for possible issues
  list        list releases
  package     package a chart directory into a chart archive
  plugin      install, list, or uninstall Helm plugins
  pull        download a chart from a repository and (optionally) unpack it in local directory
  push        push a chart to remote
  registry    login to or logout from a registry
  repo        add, list, remove, update, and index chart repositories
  rollback    roll back a release to a previous revision
  search      search for a keyword in charts
  show        show information of a chart
  status      display the status of the named release
  template    locally render templates
  test        run tests for a release
  uninstall   uninstall a release
  upgrade     upgrade a release
  verify      verify that a chart at the given path has been signed and is valid
  version     print the client version information

Flags:
      --burst-limit int                 client-side default throttling limit (default 100)
      --debug                           enable verbose output
  -h, --help                            help for helm
      --kube-apiserver string           the address and the port for the Kubernetes API server
      --kube-as-group stringArray       group to impersonate for the operation, this flag can be repeated to specify multiple groups.
      --kube-as-user string             username to impersonate for the operation
      --kube-ca-file string             the certificate authority file for the Kubernetes API server connection
      --kube-context string             name of the kubeconfig context to use
      --kube-insecure-skip-tls-verify   if true, the Kubernetes API server's certificate will not be checked for validity. This will make your HTTPS connections insecure
      --kube-tls-server-name string     server name to use for Kubernetes API server certificate validation. If it is not provided, the hostname used to contact the server is used
      --kube-token string               bearer token used for authentication
      --kubeconfig string               path to the kubeconfig file
  -n, --namespace string                namespace scope for this request
      --qps float32                     queries per second used when communicating with the Kubernetes API, not including bursting
      --registry-config string          path to the registry config file (default "/home/mavrick/.config/helm/registry/config.json")
      --repository-cache string         path to the directory containing cached repository indexes (default "/home/mavrick/.cache/helm/repository")
      --repository-config string        path to the file containing repository names and URLs (default "/home/mavrick/.config/helm/repositories.yaml")

Use "helm [command] --help" for more information about a command. command for managing Helm releases across multiple clusters, including install, upgrade, list, uninstall, rollback, status, and values operations.
- Created  command to fetch logs from containers in pods across all managed clusters.
- Developed  command to manage the rollout of resources across all managed clusters, including history, pause, restart, resume, status, and undo functionalities.
- Implemented  command to create and run images in pods across all managed clusters.
- Established a root command with custom help functions and global flags for kubeconfig, remote context, and namespace handling.
- Enhanced error handling and user feedback for operations across multiple clusters.
@MAVRICK-1
Copy link
Copy Markdown
Author

cc @clubanderson

@clubanderson
Copy link
Copy Markdown
Contributor

@MAVRICK-1 please either pair this down to be a smaller PR or fix the conflicts. Thank you

@MAVRICK-1
Copy link
Copy Markdown
Author

MAVRICK-1 commented Aug 20, 2025

@clubanderson i am solving the conflicts but , we have to it in single pr , its a migration to use the function between kubestellar cli and kubectl plugin

Comment thread README.md
Comment on lines +119 to +125
| kubectl multi | kubestellar | Description |
|--------------|-------------|-------------|
| `kubectl multi get` | `kubestellar get` | Get resources from all clusters |
| `kubectl multi apply` | `kubestellar apply` | Apply configuration to all clusters |
| `kubectl multi delete` | `kubestellar delete` | Delete resources from all clusters |
| `kubectl multi describe` | `kubestellar describe` | Describe resources across clusters |
| `kubectl multi logs` | `kubestellar logs` | Get logs from pods across clusters |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hii rishi just to make sure that both Kubectl multi and kubestellar will give the same output ? if no it is not clear here! or can you clear more here ?

Comment thread README.md
Comment on lines +189 to +197
╭─────────────────────────────────────────────────────────────────────────────────╮
│ ██╗ ██╗██╗ ██╗██████╗ ███████╗███████╗████████╗███████╗██╗ ██╗ █████╗ ██████╗ │
│ ██║ ██╔╝██║ ██║██╔══██╗██╔════╝██╔════╝╚══██╔══╝██╔════╝██║ ██║ ██╔══██╗██╔══██╗ │
│ █████╔╝ ██║ ██║██████╔╝█████╗ ███████╗ ██║ █████╗ ██║ ██║ ███████║██████╔╝ │
│ ██╔═██╗ ██║ ██║██╔══██╗██╔══╝ ╚════██║ ██║ ██╔══╝ ██║ ██║ ██╔══██║██╔══██╗ │
│ ██║ ██╗╚██████╔╝██████╔╝███████╗███████║ ██║ ███████╗███████╗███████╗██║ ██║██║ ██║ │
│ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝╚══════╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ │
│ 🌟 Multi-Cluster Kubernetes Management System 🌟 │
╰─────────────────────────────────────────────────────────────────────────────────╮
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not very clear here!

Comment thread docs/interactive_cli.md
Comment on lines +20 to +30
╭─────────────────────────────────────────────────────────────────────────────────────────────╮
│ │
│ ██╗ ██╗██╗ ██╗██████╗ ███████╗███████╗████████╗███████╗██╗ ██╗ █████╗ ██████╗ │
│ ██║ ██╔╝██║ ██║██╔══██╗██╔════╝██╔════╝╚══██╔══╝██╔════╝██║ ██║ ██╔══██╗██╔══██╗ │
│ █████╔╝ ██║ ██║██████╔╝█████╗ ███████╗ ██║ █████╗ ██║ ██║ ███████║██████╔╝ │
│ ██╔═██╗ ██║ ██║██╔══██╗██╔══╝ ╚════██║ ██║ ██╔══╝ ██║ ██║ ██╔══██║██╔══██╗ │
│ ██║ ██╗╚██████╔╝██████╔╝███████╗███████║ ██║ ███████╗███████╗███████╗██║ ██║██║ ██║ │
│ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝╚══════╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ │
│ │
│ 🌟 Multi-Cluster Kubernetes Management System 🌟 │
╰─────────────────────────────────────────────────────────────────────────────────────────────╯
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is broken ! please fix it !

Comment thread pkg/cli/cmd/helm.go
Comment on lines +23 to +35
kubestellar helm install nginx nginx/nginx

# Upgrade a release across all clusters
kubestellar helm upgrade nginx nginx/nginx --set replicas=3

# List releases across all clusters
kubestellar helm list

# Uninstall a release from all clusters
kubestellar helm uninstall nginx

# Rollback a release across all clusters
kubestellar h rollback nginx 1`,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what this will do is it just a wrapper of helm command ?
or it will install kubestellar?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to upgrade it, it will be more than just a wrapper

Comment thread pkg/cli/cmd/logs.go
Comment on lines +15 to +17
# Get logs from a specific container
kubestellar logs nginx-pod -c nginx

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not very clear with this ? the same thing kubectl-multi do now?
what special thing this logs command do ? I want just make sure the idea and will not present delicately here!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +49 to +66
cli.cyan.Println("│")
cli.cyan.Print("│ ")
cli.bold.Print("██╗ ██╗██╗ ██╗██████╗ ███████╗███████╗████████╗███████╗███████╗███████╗██╗ █████╗ ██████╗ ")
cli.cyan.Println("│")
cli.cyan.Print("│ ")
cli.bold.Print("██║ ██╔╝██║ ██║██╔══██╗██╔════╝██╔════╝╚══██╔══╝██╔════╝██╔════╝██╔════╝██║ ██╔══██╗██╔══██╗")
cli.cyan.Println("│")
cli.cyan.Print("│ ")
cli.bold.Print("█████╔╝ ██║ ██║██████╔╝█████╗ ███████╗ ██║ █████╗ ███████╗███████╗██║ ███████║██████╔╝")
cli.cyan.Println("│")
cli.cyan.Print("│ ")
cli.bold.Print("██╔═██╗ ██║ ██║██╔══██╗██╔══╝ ╚════██║ ██║ ██╔══╝ ╚════██║╚════██║██║ ██╔══██║██╔══██╗")
cli.cyan.Println("│")
cli.cyan.Print("│ ")
cli.bold.Print("██║ ██╗╚██████╔╝██████╔╝███████╗███████║ ██║ ███████╗███████║███████║███████╗██║ ██║██║ ██║")
cli.cyan.Println("│")
cli.cyan.Print("│ ")
cli.bold.Print("╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝╚══════╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

broken msg here ! please fixed it !

}
fmt.Println()

// TODO: Implement actual delete operation using core operations
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my concern is that there is lots of TODO in this file so , is it enough mature to add in the main branch ?

Copy link
Copy Markdown
Author

@MAVRICK-1 MAVRICK-1 Aug 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a lot of things to implement before it to make it streamline . So next pr will look into or else this pr will be of 10 k+ lines .
Its not production ready so it won't be problem

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a lot of things to implement before it to make it streamline . So next pr will look into or else this pr will be of 10 k+ lines . Its not production ready so it won't be problem

fine, but still it is a big PR will it work as expected?
did you test all command ?
else we have to it will be good if you go with small PRs!
or a with test cases that the prs pass !

Comment thread pkg/kubectl/cmd/helm.go
Comment on lines +209 to +215
kubectl multi helm list --all-namespaces

# List only deployed releases
kubectl multi h list --deployed

# List failed releases
kubectl multi h ls --failed`,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you have used kubectl multi helm and kubectl multi h both ! you should stick with one only!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's short hand like,
K get namespace and k get ns

@Rupam-It
Copy link
Copy Markdown
Contributor

Hii @MAVRICK-1 thanks you so much for this PR! really appreciate your work !
I have review it and make some comments !
also my concern is that this PR is really big we should take a test result that all command are working in correct condition !

@MAVRICK-1
Copy link
Copy Markdown
Author

Some updates are left to do

@clubanderson
Copy link
Copy Markdown
Contributor

yes, @Rupam-It made good progress on fixing commands recently - we do not want to lose this.

@kubestellar-prow kubestellar-prow Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 12, 2026
@kubestellar-prow
Copy link
Copy Markdown
Contributor

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@clubanderson clubanderson added the kind/feature Categorizes issue or PR as related to a new feature. label Jan 13, 2026
@clubanderson
Copy link
Copy Markdown
Contributor

❌ PR Title Verification Failed

Your PR title does not follow the required format.

Current title: Implement multi-cluster support for kubectl commands

Required Format

PR titles must start with one of these emoji prefixes:

Emoji Meaning
⚠️ Breaking change
Non-breaking feature
🐛 Patch fix / Bug fix
📖 Documentation
🚀 Release
🌱 Infra/Tests/Other

How to Fix

Edit your PR title to start with the appropriate emoji. For example:

  • ✨ Add new feature for user authentication
  • 🐛 Fix crash when loading empty config
  • 📖 Update installation guide

You can edit the title by clicking the Edit button next to your PR title.


This comment was posted to help you fix the PR title format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature Categorizes issue or PR as related to a new feature. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create Standalone KubeStellar CLI with Shared Core Functionality

3 participants