From 78d7dca985ea1c4e1b0122043590eec4f437377e Mon Sep 17 00:00:00 2001
From: Sylvain Rabot <sylvain@abstraction.fr>
Date: Mon, 2 Nov 2020 20:50:14 +0100
Subject: [PATCH] Add a --context option

Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>
---
 cmd/flux/bootstrap_github.go              |  2 +-
 cmd/flux/bootstrap_gitlab.go              |  2 +-
 cmd/flux/create_alert.go                  |  2 +-
 cmd/flux/create_alertprovider.go          |  2 +-
 cmd/flux/create_helmrelease.go            |  2 +-
 cmd/flux/create_kustomization.go          |  2 +-
 cmd/flux/create_receiver.go               |  2 +-
 cmd/flux/create_source_bucket.go          |  2 +-
 cmd/flux/create_source_git.go             |  2 +-
 cmd/flux/create_source_helm.go            |  2 +-
 cmd/flux/create_tenant.go                 |  2 +-
 cmd/flux/delete_alert.go                  |  2 +-
 cmd/flux/delete_alertprovider.go          |  2 +-
 cmd/flux/delete_helmrelease.go            |  2 +-
 cmd/flux/delete_kustomization.go          |  2 +-
 cmd/flux/delete_receiver.go               |  2 +-
 cmd/flux/delete_source_bucket.go          |  2 +-
 cmd/flux/delete_source_git.go             |  2 +-
 cmd/flux/delete_source_helm.go            |  2 +-
 cmd/flux/export_alert.go                  |  2 +-
 cmd/flux/export_alertprovider.go          |  2 +-
 cmd/flux/export_helmrelease.go            |  2 +-
 cmd/flux/export_kustomization.go          |  2 +-
 cmd/flux/export_receiver.go               |  2 +-
 cmd/flux/export_source_bucket.go          |  2 +-
 cmd/flux/export_source_git.go             |  2 +-
 cmd/flux/export_source_helm.go            |  2 +-
 cmd/flux/get_alert.go                     |  2 +-
 cmd/flux/get_alertprovider.go             |  2 +-
 cmd/flux/get_helmrelease.go               |  2 +-
 cmd/flux/get_kustomization.go             |  2 +-
 cmd/flux/get_receiver.go                  |  2 +-
 cmd/flux/get_source_bucket.go             |  2 +-
 cmd/flux/get_source_git.go                |  2 +-
 cmd/flux/get_source_helm.go               |  2 +-
 cmd/flux/main.go                          |  2 ++
 cmd/flux/reconcile_alert.go               |  2 +-
 cmd/flux/reconcile_alertprovider.go       |  2 +-
 cmd/flux/reconcile_helmrelease.go         |  2 +-
 cmd/flux/reconcile_kustomization.go       |  2 +-
 cmd/flux/reconcile_receiver.go            |  2 +-
 cmd/flux/reconcile_source_bucket.go       |  2 +-
 cmd/flux/reconcile_source_git.go          |  2 +-
 cmd/flux/reconcile_source_helm.go         |  2 +-
 cmd/flux/resume_alert.go                  |  2 +-
 cmd/flux/resume_helmrelease.go            |  2 +-
 cmd/flux/resume_kustomization.go          |  2 +-
 cmd/flux/resume_receiver.go               |  2 +-
 cmd/flux/suspend_alert.go                 |  2 +-
 cmd/flux/suspend_helmrelease.go           |  2 +-
 cmd/flux/suspend_kustomization.go         |  2 +-
 cmd/flux/suspend_receiver.go              |  2 +-
 cmd/flux/uninstall.go                     |  2 +-
 docs/cmd/flux.md                          |  1 +
 docs/cmd/flux_bootstrap.md                |  1 +
 docs/cmd/flux_bootstrap_github.md         |  1 +
 docs/cmd/flux_bootstrap_gitlab.md         |  1 +
 docs/cmd/flux_check.md                    |  1 +
 docs/cmd/flux_completion.md               |  1 +
 docs/cmd/flux_completion_bash.md          |  1 +
 docs/cmd/flux_completion_fish.md          |  1 +
 docs/cmd/flux_completion_powershell.md    |  1 +
 docs/cmd/flux_completion_zsh.md           |  1 +
 docs/cmd/flux_create.md                   |  1 +
 docs/cmd/flux_create_alert-provider.md    |  1 +
 docs/cmd/flux_create_alert.md             |  1 +
 docs/cmd/flux_create_helmrelease.md       |  1 +
 docs/cmd/flux_create_kustomization.md     |  1 +
 docs/cmd/flux_create_receiver.md          |  1 +
 docs/cmd/flux_create_source.md            |  1 +
 docs/cmd/flux_create_source_bucket.md     |  1 +
 docs/cmd/flux_create_source_git.md        |  1 +
 docs/cmd/flux_create_source_helm.md       |  1 +
 docs/cmd/flux_delete.md                   |  1 +
 docs/cmd/flux_delete_alert-provider.md    |  1 +
 docs/cmd/flux_delete_alert.md             |  1 +
 docs/cmd/flux_delete_helmrelease.md       |  1 +
 docs/cmd/flux_delete_kustomization.md     |  1 +
 docs/cmd/flux_delete_receiver.md          |  1 +
 docs/cmd/flux_delete_source.md            |  1 +
 docs/cmd/flux_delete_source_bucket.md     |  1 +
 docs/cmd/flux_delete_source_git.md        |  1 +
 docs/cmd/flux_delete_source_helm.md       |  1 +
 docs/cmd/flux_export.md                   |  1 +
 docs/cmd/flux_export_alert-provider.md    |  1 +
 docs/cmd/flux_export_alert.md             |  1 +
 docs/cmd/flux_export_helmrelease.md       |  1 +
 docs/cmd/flux_export_kustomization.md     |  1 +
 docs/cmd/flux_export_receiver.md          |  1 +
 docs/cmd/flux_export_source.md            |  1 +
 docs/cmd/flux_export_source_bucket.md     |  1 +
 docs/cmd/flux_export_source_git.md        |  1 +
 docs/cmd/flux_export_source_helm.md       |  1 +
 docs/cmd/flux_get.md                      |  1 +
 docs/cmd/flux_get_alert-providers.md      |  1 +
 docs/cmd/flux_get_alerts.md               |  1 +
 docs/cmd/flux_get_helmreleases.md         |  1 +
 docs/cmd/flux_get_kustomizations.md       |  1 +
 docs/cmd/flux_get_receivers.md            |  1 +
 docs/cmd/flux_get_sources.md              |  1 +
 docs/cmd/flux_get_sources_bucket.md       |  1 +
 docs/cmd/flux_get_sources_git.md          |  1 +
 docs/cmd/flux_get_sources_helm.md         |  1 +
 docs/cmd/flux_install.md                  |  1 +
 docs/cmd/flux_reconcile.md                |  1 +
 docs/cmd/flux_reconcile_alert-provider.md |  1 +
 docs/cmd/flux_reconcile_alert.md          |  1 +
 docs/cmd/flux_reconcile_helmrelease.md    |  1 +
 docs/cmd/flux_reconcile_kustomization.md  |  1 +
 docs/cmd/flux_reconcile_receiver.md       |  1 +
 docs/cmd/flux_reconcile_source.md         |  1 +
 docs/cmd/flux_reconcile_source_bucket.md  |  1 +
 docs/cmd/flux_reconcile_source_git.md     |  1 +
 docs/cmd/flux_reconcile_source_helm.md    |  1 +
 docs/cmd/flux_resume.md                   |  1 +
 docs/cmd/flux_resume_alert.md             |  1 +
 docs/cmd/flux_resume_helmrelease.md       |  1 +
 docs/cmd/flux_resume_kustomization.md     |  1 +
 docs/cmd/flux_resume_receiver.md          |  1 +
 docs/cmd/flux_suspend.md                  |  1 +
 docs/cmd/flux_suspend_alert.md            |  1 +
 docs/cmd/flux_suspend_helmrelease.md      |  1 +
 docs/cmd/flux_suspend_kustomization.md    |  1 +
 docs/cmd/flux_suspend_receiver.md         |  1 +
 docs/cmd/flux_uninstall.md                |  1 +
 internal/utils/utils.go                   | 12 ++++++++++--
 126 files changed, 136 insertions(+), 54 deletions(-)

diff --git a/cmd/flux/bootstrap_github.go b/cmd/flux/bootstrap_github.go
index 08bfeedc..5565a98a 100644
--- a/cmd/flux/bootstrap_github.go
+++ b/cmd/flux/bootstrap_github.go
@@ -184,7 +184,7 @@ func bootstrapGitHubCmdRun(cmd *cobra.Command, args []string) error {
 		logger.Successf("components are up to date")
 	}
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/bootstrap_gitlab.go b/cmd/flux/bootstrap_gitlab.go
index 5c1364ff..5d504def 100644
--- a/cmd/flux/bootstrap_gitlab.go
+++ b/cmd/flux/bootstrap_gitlab.go
@@ -113,7 +113,7 @@ func bootstrapGitLabCmdRun(cmd *cobra.Command, args []string) error {
 		IsPersonal: glPersonal,
 	}
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/create_alert.go b/cmd/flux/create_alert.go
index 1a570c00..0edfd1c3 100644
--- a/cmd/flux/create_alert.go
+++ b/cmd/flux/create_alert.go
@@ -120,7 +120,7 @@ func createAlertCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/create_alertprovider.go b/cmd/flux/create_alertprovider.go
index b1efbb2f..71315f4e 100644
--- a/cmd/flux/create_alertprovider.go
+++ b/cmd/flux/create_alertprovider.go
@@ -116,7 +116,7 @@ func createAlertProviderCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/create_helmrelease.go b/cmd/flux/create_helmrelease.go
index 99a198ea..f4c94ae0 100644
--- a/cmd/flux/create_helmrelease.go
+++ b/cmd/flux/create_helmrelease.go
@@ -177,7 +177,7 @@ func createHelmReleaseCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/create_kustomization.go b/cmd/flux/create_kustomization.go
index cf579aac..03dd4c2d 100644
--- a/cmd/flux/create_kustomization.go
+++ b/cmd/flux/create_kustomization.go
@@ -209,7 +209,7 @@ func createKsCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/create_receiver.go b/cmd/flux/create_receiver.go
index 233f36cb..8576c4d4 100644
--- a/cmd/flux/create_receiver.go
+++ b/cmd/flux/create_receiver.go
@@ -128,7 +128,7 @@ func createReceiverCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/create_source_bucket.go b/cmd/flux/create_source_bucket.go
index 9bc9144c..da50b562 100644
--- a/cmd/flux/create_source_bucket.go
+++ b/cmd/flux/create_source_bucket.go
@@ -140,7 +140,7 @@ func createSourceBucketCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/create_source_git.go b/cmd/flux/create_source_git.go
index 7714c5c7..04ea0f32 100644
--- a/cmd/flux/create_source_git.go
+++ b/cmd/flux/create_source_git.go
@@ -176,7 +176,7 @@ func createSourceGitCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/create_source_helm.go b/cmd/flux/create_source_helm.go
index 4a21c4e6..d6c94617 100644
--- a/cmd/flux/create_source_helm.go
+++ b/cmd/flux/create_source_helm.go
@@ -136,7 +136,7 @@ func createSourceHelmCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/create_tenant.go b/cmd/flux/create_tenant.go
index b8a539bf..e6a1a30a 100644
--- a/cmd/flux/create_tenant.go
+++ b/cmd/flux/create_tenant.go
@@ -145,7 +145,7 @@ func createTenantCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/delete_alert.go b/cmd/flux/delete_alert.go
index ce48ef89..bb8cb0bc 100644
--- a/cmd/flux/delete_alert.go
+++ b/cmd/flux/delete_alert.go
@@ -51,7 +51,7 @@ func deleteAlertCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/delete_alertprovider.go b/cmd/flux/delete_alertprovider.go
index 7487e089..c3ebc908 100644
--- a/cmd/flux/delete_alertprovider.go
+++ b/cmd/flux/delete_alertprovider.go
@@ -51,7 +51,7 @@ func deleteAlertProviderCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/delete_helmrelease.go b/cmd/flux/delete_helmrelease.go
index d14227a9..47249bda 100644
--- a/cmd/flux/delete_helmrelease.go
+++ b/cmd/flux/delete_helmrelease.go
@@ -52,7 +52,7 @@ func deleteHelmReleaseCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/delete_kustomization.go b/cmd/flux/delete_kustomization.go
index aa899296..0d1fef3d 100644
--- a/cmd/flux/delete_kustomization.go
+++ b/cmd/flux/delete_kustomization.go
@@ -51,7 +51,7 @@ func deleteKsCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/delete_receiver.go b/cmd/flux/delete_receiver.go
index 618fa307..b92fe83f 100644
--- a/cmd/flux/delete_receiver.go
+++ b/cmd/flux/delete_receiver.go
@@ -51,7 +51,7 @@ func deleteReceiverCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/delete_source_bucket.go b/cmd/flux/delete_source_bucket.go
index 812defd7..ccdcf3f1 100644
--- a/cmd/flux/delete_source_bucket.go
+++ b/cmd/flux/delete_source_bucket.go
@@ -50,7 +50,7 @@ func deleteSourceBucketCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/delete_source_git.go b/cmd/flux/delete_source_git.go
index 7b350ff4..7173c3a1 100644
--- a/cmd/flux/delete_source_git.go
+++ b/cmd/flux/delete_source_git.go
@@ -50,7 +50,7 @@ func deleteSourceGitCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/delete_source_helm.go b/cmd/flux/delete_source_helm.go
index 0cc83e87..5eb10d51 100644
--- a/cmd/flux/delete_source_helm.go
+++ b/cmd/flux/delete_source_helm.go
@@ -50,7 +50,7 @@ func deleteSourceHelmCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/export_alert.go b/cmd/flux/export_alert.go
index 43bf7373..8fa7ba42 100644
--- a/cmd/flux/export_alert.go
+++ b/cmd/flux/export_alert.go
@@ -55,7 +55,7 @@ func exportAlertCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/export_alertprovider.go b/cmd/flux/export_alertprovider.go
index 0bc3747f..2d805e40 100644
--- a/cmd/flux/export_alertprovider.go
+++ b/cmd/flux/export_alertprovider.go
@@ -55,7 +55,7 @@ func exportAlertProviderCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/export_helmrelease.go b/cmd/flux/export_helmrelease.go
index e533ae23..dff04b61 100644
--- a/cmd/flux/export_helmrelease.go
+++ b/cmd/flux/export_helmrelease.go
@@ -56,7 +56,7 @@ func exportHelmReleaseCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/export_kustomization.go b/cmd/flux/export_kustomization.go
index 4a28e91e..86c33aca 100644
--- a/cmd/flux/export_kustomization.go
+++ b/cmd/flux/export_kustomization.go
@@ -56,7 +56,7 @@ func exportKsCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/export_receiver.go b/cmd/flux/export_receiver.go
index 654c82ec..ebecabef 100644
--- a/cmd/flux/export_receiver.go
+++ b/cmd/flux/export_receiver.go
@@ -55,7 +55,7 @@ func exportReceiverCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/export_source_bucket.go b/cmd/flux/export_source_bucket.go
index c7acd500..32e20322 100644
--- a/cmd/flux/export_source_bucket.go
+++ b/cmd/flux/export_source_bucket.go
@@ -56,7 +56,7 @@ func exportSourceBucketCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/export_source_git.go b/cmd/flux/export_source_git.go
index 038a8772..6a422d78 100644
--- a/cmd/flux/export_source_git.go
+++ b/cmd/flux/export_source_git.go
@@ -56,7 +56,7 @@ func exportSourceGitCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/export_source_helm.go b/cmd/flux/export_source_helm.go
index 879af6c5..756bf7fa 100644
--- a/cmd/flux/export_source_helm.go
+++ b/cmd/flux/export_source_helm.go
@@ -56,7 +56,7 @@ func exportSourceHelmCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/get_alert.go b/cmd/flux/get_alert.go
index 9bf17c53..c66c6e74 100644
--- a/cmd/flux/get_alert.go
+++ b/cmd/flux/get_alert.go
@@ -49,7 +49,7 @@ func getAlertCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/get_alertprovider.go b/cmd/flux/get_alertprovider.go
index 1342057a..cb1bda4a 100644
--- a/cmd/flux/get_alertprovider.go
+++ b/cmd/flux/get_alertprovider.go
@@ -47,7 +47,7 @@ func getAlertProviderCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/get_helmrelease.go b/cmd/flux/get_helmrelease.go
index 6d970244..ce093f93 100644
--- a/cmd/flux/get_helmrelease.go
+++ b/cmd/flux/get_helmrelease.go
@@ -51,7 +51,7 @@ func getHelmReleaseCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/get_kustomization.go b/cmd/flux/get_kustomization.go
index d56ea34c..475767c5 100644
--- a/cmd/flux/get_kustomization.go
+++ b/cmd/flux/get_kustomization.go
@@ -50,7 +50,7 @@ func getKsCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/get_receiver.go b/cmd/flux/get_receiver.go
index 6ae69c60..4bcfb11a 100644
--- a/cmd/flux/get_receiver.go
+++ b/cmd/flux/get_receiver.go
@@ -49,7 +49,7 @@ func getReceiverCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/get_source_bucket.go b/cmd/flux/get_source_bucket.go
index e8026b83..c7983936 100644
--- a/cmd/flux/get_source_bucket.go
+++ b/cmd/flux/get_source_bucket.go
@@ -47,7 +47,7 @@ func getSourceBucketCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/get_source_git.go b/cmd/flux/get_source_git.go
index 04f0526c..f1878027 100644
--- a/cmd/flux/get_source_git.go
+++ b/cmd/flux/get_source_git.go
@@ -47,7 +47,7 @@ func getSourceGitCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/get_source_helm.go b/cmd/flux/get_source_helm.go
index 639fd0e6..daec292d 100644
--- a/cmd/flux/get_source_helm.go
+++ b/cmd/flux/get_source_helm.go
@@ -47,7 +47,7 @@ func getSourceHelmCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/main.go b/cmd/flux/main.go
index 4205b082..e9742fd5 100644
--- a/cmd/flux/main.go
+++ b/cmd/flux/main.go
@@ -96,6 +96,7 @@ var rootCmd = &cobra.Command{
 
 var (
 	kubeconfig   string
+	kubecontext  string
 	namespace    string
 	timeout      time.Duration
 	verbose      bool
@@ -108,6 +109,7 @@ func init() {
 	rootCmd.PersistentFlags().StringVarP(&namespace, "namespace", "n", defaults.Namespace, "the namespace scope for this operation")
 	rootCmd.PersistentFlags().DurationVar(&timeout, "timeout", 5*time.Minute, "timeout for this operation")
 	rootCmd.PersistentFlags().BoolVar(&verbose, "verbose", false, "print generated objects")
+	rootCmd.PersistentFlags().StringVarP(&kubecontext, "context", "", "", "kubernetes context to use")
 }
 
 func main() {
diff --git a/cmd/flux/reconcile_alert.go b/cmd/flux/reconcile_alert.go
index f895a608..71b52867 100644
--- a/cmd/flux/reconcile_alert.go
+++ b/cmd/flux/reconcile_alert.go
@@ -54,7 +54,7 @@ func reconcileAlertCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/reconcile_alertprovider.go b/cmd/flux/reconcile_alertprovider.go
index 5c5b829d..3b76bf00 100644
--- a/cmd/flux/reconcile_alertprovider.go
+++ b/cmd/flux/reconcile_alertprovider.go
@@ -54,7 +54,7 @@ func reconcileAlertProviderCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/reconcile_helmrelease.go b/cmd/flux/reconcile_helmrelease.go
index 3371d184..9c5a6a63 100644
--- a/cmd/flux/reconcile_helmrelease.go
+++ b/cmd/flux/reconcile_helmrelease.go
@@ -69,7 +69,7 @@ func reconcileHrCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/reconcile_kustomization.go b/cmd/flux/reconcile_kustomization.go
index 09e7ff67..2f1940dd 100644
--- a/cmd/flux/reconcile_kustomization.go
+++ b/cmd/flux/reconcile_kustomization.go
@@ -69,7 +69,7 @@ func reconcileKsCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/reconcile_receiver.go b/cmd/flux/reconcile_receiver.go
index a874b391..16ce2e55 100644
--- a/cmd/flux/reconcile_receiver.go
+++ b/cmd/flux/reconcile_receiver.go
@@ -54,7 +54,7 @@ func reconcileReceiverCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/reconcile_source_bucket.go b/cmd/flux/reconcile_source_bucket.go
index 40c237f3..f1a638e5 100644
--- a/cmd/flux/reconcile_source_bucket.go
+++ b/cmd/flux/reconcile_source_bucket.go
@@ -56,7 +56,7 @@ func reconcileSourceBucketCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/reconcile_source_git.go b/cmd/flux/reconcile_source_git.go
index 2a603285..31cbc0b1 100644
--- a/cmd/flux/reconcile_source_git.go
+++ b/cmd/flux/reconcile_source_git.go
@@ -54,7 +54,7 @@ func reconcileSourceGitCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/reconcile_source_helm.go b/cmd/flux/reconcile_source_helm.go
index ae50c612..066509b7 100644
--- a/cmd/flux/reconcile_source_helm.go
+++ b/cmd/flux/reconcile_source_helm.go
@@ -56,7 +56,7 @@ func reconcileSourceHelmCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/resume_alert.go b/cmd/flux/resume_alert.go
index 5186392e..fcb5aab0 100644
--- a/cmd/flux/resume_alert.go
+++ b/cmd/flux/resume_alert.go
@@ -56,7 +56,7 @@ func resumeAlertCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/resume_helmrelease.go b/cmd/flux/resume_helmrelease.go
index 0558d3a9..3cafd0f5 100644
--- a/cmd/flux/resume_helmrelease.go
+++ b/cmd/flux/resume_helmrelease.go
@@ -57,7 +57,7 @@ func resumeHrCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/resume_kustomization.go b/cmd/flux/resume_kustomization.go
index 9de37bb7..b6e4dd6a 100644
--- a/cmd/flux/resume_kustomization.go
+++ b/cmd/flux/resume_kustomization.go
@@ -56,7 +56,7 @@ func resumeKsCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/resume_receiver.go b/cmd/flux/resume_receiver.go
index 7e51477f..42c829f8 100644
--- a/cmd/flux/resume_receiver.go
+++ b/cmd/flux/resume_receiver.go
@@ -56,7 +56,7 @@ func resumeReceiverCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/suspend_alert.go b/cmd/flux/suspend_alert.go
index e9f58943..6d2b11d9 100644
--- a/cmd/flux/suspend_alert.go
+++ b/cmd/flux/suspend_alert.go
@@ -50,7 +50,7 @@ func suspendAlertCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/suspend_helmrelease.go b/cmd/flux/suspend_helmrelease.go
index 32029b36..eef5c05b 100644
--- a/cmd/flux/suspend_helmrelease.go
+++ b/cmd/flux/suspend_helmrelease.go
@@ -51,7 +51,7 @@ func suspendHrCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/suspend_kustomization.go b/cmd/flux/suspend_kustomization.go
index c9723bc0..39dc9167 100644
--- a/cmd/flux/suspend_kustomization.go
+++ b/cmd/flux/suspend_kustomization.go
@@ -50,7 +50,7 @@ func suspendKsCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/suspend_receiver.go b/cmd/flux/suspend_receiver.go
index 0dbb763e..e8877e77 100644
--- a/cmd/flux/suspend_receiver.go
+++ b/cmd/flux/suspend_receiver.go
@@ -50,7 +50,7 @@ func suspendReceiverCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/flux/uninstall.go b/cmd/flux/uninstall.go
index eed2f493..35a615d2 100644
--- a/cmd/flux/uninstall.go
+++ b/cmd/flux/uninstall.go
@@ -69,7 +69,7 @@ func uninstallCmdRun(cmd *cobra.Command, args []string) error {
 	ctx, cancel := context.WithTimeout(context.Background(), timeout)
 	defer cancel()
 
-	kubeClient, err := utils.KubeClient(kubeconfig)
+	kubeClient, err := utils.KubeClient(kubeconfig, kubecontext)
 	if err != nil {
 		return err
 	}
diff --git a/docs/cmd/flux.md b/docs/cmd/flux.md
index cde824d8..34b9ea85 100644
--- a/docs/cmd/flux.md
+++ b/docs/cmd/flux.md
@@ -67,6 +67,7 @@ Command line utility for assembling Kubernetes CD pipelines the GitOps way.
 ### Options
 
 ```
+      --context string      kubernetes context to use
   -h, --help                help for flux
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
diff --git a/docs/cmd/flux_bootstrap.md b/docs/cmd/flux_bootstrap.md
index 9295229c..5a74161a 100644
--- a/docs/cmd/flux_bootstrap.md
+++ b/docs/cmd/flux_bootstrap.md
@@ -24,6 +24,7 @@ The bootstrap sub-commands bootstrap the toolkit components on the targeted Git
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_bootstrap_github.md b/docs/cmd/flux_bootstrap_github.md
index bb3d4bc1..a105a216 100644
--- a/docs/cmd/flux_bootstrap_github.md
+++ b/docs/cmd/flux_bootstrap_github.md
@@ -60,6 +60,7 @@ flux bootstrap github [flags]
       --arch arch                  cluster architecture, available options are: (amd64, arm, arm64) (default amd64)
       --branch string              default branch (for GitHub this must match the default branch setting for the organization) (default "main")
       --components strings         list of components, accepts comma-separated values (default [source-controller,kustomize-controller,helm-controller,notification-controller])
+      --context string             kubernetes context to use
       --image-pull-secret string   Kubernetes secret name used for pulling the toolkit images from a private registry
       --kubeconfig string          path to the kubeconfig file (default "~/.kube/config")
       --log-level logLevel         log level, available options are: (debug, info, error) (default info)
diff --git a/docs/cmd/flux_bootstrap_gitlab.md b/docs/cmd/flux_bootstrap_gitlab.md
index e320dff1..131d7441 100644
--- a/docs/cmd/flux_bootstrap_gitlab.md
+++ b/docs/cmd/flux_bootstrap_gitlab.md
@@ -60,6 +60,7 @@ flux bootstrap gitlab [flags]
       --arch arch                  cluster architecture, available options are: (amd64, arm, arm64) (default amd64)
       --branch string              default branch (for GitHub this must match the default branch setting for the organization) (default "main")
       --components strings         list of components, accepts comma-separated values (default [source-controller,kustomize-controller,helm-controller,notification-controller])
+      --context string             kubernetes context to use
       --image-pull-secret string   Kubernetes secret name used for pulling the toolkit images from a private registry
       --kubeconfig string          path to the kubeconfig file (default "~/.kube/config")
       --log-level logLevel         log level, available options are: (debug, info, error) (default info)
diff --git a/docs/cmd/flux_check.md b/docs/cmd/flux_check.md
index d84f6ee8..dd397326 100644
--- a/docs/cmd/flux_check.md
+++ b/docs/cmd/flux_check.md
@@ -33,6 +33,7 @@ flux check [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_completion.md b/docs/cmd/flux_completion.md
index c129c268..ef0e00c8 100644
--- a/docs/cmd/flux_completion.md
+++ b/docs/cmd/flux_completion.md
@@ -15,6 +15,7 @@ The completion sub-command generates completion scripts for various shells
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_completion_bash.md b/docs/cmd/flux_completion_bash.md
index 1d774ca6..c0038fe3 100644
--- a/docs/cmd/flux_completion_bash.md
+++ b/docs/cmd/flux_completion_bash.md
@@ -33,6 +33,7 @@ command -v flux >/dev/null && . <(flux completion bash)
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_completion_fish.md b/docs/cmd/flux_completion_fish.md
index 37dd69f8..662b9f7e 100644
--- a/docs/cmd/flux_completion_fish.md
+++ b/docs/cmd/flux_completion_fish.md
@@ -34,6 +34,7 @@ See http://fishshell.com/docs/current/index.html#completion-own for more details
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_completion_powershell.md b/docs/cmd/flux_completion_powershell.md
index f2980bb1..92de9ede 100644
--- a/docs/cmd/flux_completion_powershell.md
+++ b/docs/cmd/flux_completion_powershell.md
@@ -40,6 +40,7 @@ flux completion >> flux-completions.ps1
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_completion_zsh.md b/docs/cmd/flux_completion_zsh.md
index 3b7c51fd..f77af5ea 100644
--- a/docs/cmd/flux_completion_zsh.md
+++ b/docs/cmd/flux_completion_zsh.md
@@ -41,6 +41,7 @@ mv _flux ~/.zprezto/modules/completion/external/src/  # zprezto
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_create.md b/docs/cmd/flux_create.md
index 4f5a8e01..48acbae7 100644
--- a/docs/cmd/flux_create.md
+++ b/docs/cmd/flux_create.md
@@ -18,6 +18,7 @@ The create sub-commands generate sources and resources.
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_create_alert-provider.md b/docs/cmd/flux_create_alert-provider.md
index 80d8cf17..27af0b89 100644
--- a/docs/cmd/flux_create_alert-provider.md
+++ b/docs/cmd/flux_create_alert-provider.md
@@ -42,6 +42,7 @@ flux create alert-provider [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --export              export in YAML format to stdout
       --interval duration   source sync interval (default 1m0s)
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
diff --git a/docs/cmd/flux_create_alert.md b/docs/cmd/flux_create_alert.md
index c5a2a3fe..be8abd0b 100644
--- a/docs/cmd/flux_create_alert.md
+++ b/docs/cmd/flux_create_alert.md
@@ -34,6 +34,7 @@ flux create alert [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --export              export in YAML format to stdout
       --interval duration   source sync interval (default 1m0s)
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
diff --git a/docs/cmd/flux_create_helmrelease.md b/docs/cmd/flux_create_helmrelease.md
index 86fa38ec..e1481296 100644
--- a/docs/cmd/flux_create_helmrelease.md
+++ b/docs/cmd/flux_create_helmrelease.md
@@ -75,6 +75,7 @@ flux create helmrelease [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --export              export in YAML format to stdout
       --interval duration   source sync interval (default 1m0s)
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
diff --git a/docs/cmd/flux_create_kustomization.md b/docs/cmd/flux_create_kustomization.md
index 098fa9e1..39cb8cc3 100644
--- a/docs/cmd/flux_create_kustomization.md
+++ b/docs/cmd/flux_create_kustomization.md
@@ -61,6 +61,7 @@ flux create kustomization [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --export              export in YAML format to stdout
       --interval duration   source sync interval (default 1m0s)
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
diff --git a/docs/cmd/flux_create_receiver.md b/docs/cmd/flux_create_receiver.md
index 69437bad..6167fb0f 100644
--- a/docs/cmd/flux_create_receiver.md
+++ b/docs/cmd/flux_create_receiver.md
@@ -37,6 +37,7 @@ flux create receiver [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --export              export in YAML format to stdout
       --interval duration   source sync interval (default 1m0s)
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
diff --git a/docs/cmd/flux_create_source.md b/docs/cmd/flux_create_source.md
index 067cca6d..83e5137f 100644
--- a/docs/cmd/flux_create_source.md
+++ b/docs/cmd/flux_create_source.md
@@ -15,6 +15,7 @@ The create source sub-commands generate sources.
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --export              export in YAML format to stdout
       --interval duration   source sync interval (default 1m0s)
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
diff --git a/docs/cmd/flux_create_source_bucket.md b/docs/cmd/flux_create_source_bucket.md
index b1f7b408..5254b5b4 100644
--- a/docs/cmd/flux_create_source_bucket.md
+++ b/docs/cmd/flux_create_source_bucket.md
@@ -51,6 +51,7 @@ flux create source bucket [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --export              export in YAML format to stdout
       --interval duration   source sync interval (default 1m0s)
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
diff --git a/docs/cmd/flux_create_source_git.md b/docs/cmd/flux_create_source_git.md
index 5aa1b984..0a1110fb 100644
--- a/docs/cmd/flux_create_source_git.md
+++ b/docs/cmd/flux_create_source_git.md
@@ -71,6 +71,7 @@ flux create source git [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --export              export in YAML format to stdout
       --interval duration   source sync interval (default 1m0s)
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
diff --git a/docs/cmd/flux_create_source_helm.md b/docs/cmd/flux_create_source_helm.md
index 0d5be022..267727db 100644
--- a/docs/cmd/flux_create_source_helm.md
+++ b/docs/cmd/flux_create_source_helm.md
@@ -51,6 +51,7 @@ flux create source helm [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --export              export in YAML format to stdout
       --interval duration   source sync interval (default 1m0s)
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
diff --git a/docs/cmd/flux_delete.md b/docs/cmd/flux_delete.md
index 0e01c53e..2628ab8f 100644
--- a/docs/cmd/flux_delete.md
+++ b/docs/cmd/flux_delete.md
@@ -16,6 +16,7 @@ The delete sub-commands delete sources and resources.
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_delete_alert-provider.md b/docs/cmd/flux_delete_alert-provider.md
index 66b96181..2e24c650 100644
--- a/docs/cmd/flux_delete_alert-provider.md
+++ b/docs/cmd/flux_delete_alert-provider.md
@@ -27,6 +27,7 @@ flux delete alert-provider [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
   -s, --silent              delete resource without asking for confirmation
diff --git a/docs/cmd/flux_delete_alert.md b/docs/cmd/flux_delete_alert.md
index f596e32d..caa6aac0 100644
--- a/docs/cmd/flux_delete_alert.md
+++ b/docs/cmd/flux_delete_alert.md
@@ -27,6 +27,7 @@ flux delete alert [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
   -s, --silent              delete resource without asking for confirmation
diff --git a/docs/cmd/flux_delete_helmrelease.md b/docs/cmd/flux_delete_helmrelease.md
index dbfc70d2..0b0b3997 100644
--- a/docs/cmd/flux_delete_helmrelease.md
+++ b/docs/cmd/flux_delete_helmrelease.md
@@ -27,6 +27,7 @@ flux delete helmrelease [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
   -s, --silent              delete resource without asking for confirmation
diff --git a/docs/cmd/flux_delete_kustomization.md b/docs/cmd/flux_delete_kustomization.md
index d4a2ed25..f25c7fb9 100644
--- a/docs/cmd/flux_delete_kustomization.md
+++ b/docs/cmd/flux_delete_kustomization.md
@@ -27,6 +27,7 @@ flux delete kustomization [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
   -s, --silent              delete resource without asking for confirmation
diff --git a/docs/cmd/flux_delete_receiver.md b/docs/cmd/flux_delete_receiver.md
index bd3324e3..459aa6cd 100644
--- a/docs/cmd/flux_delete_receiver.md
+++ b/docs/cmd/flux_delete_receiver.md
@@ -27,6 +27,7 @@ flux delete receiver [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
   -s, --silent              delete resource without asking for confirmation
diff --git a/docs/cmd/flux_delete_source.md b/docs/cmd/flux_delete_source.md
index a5442963..291eccab 100644
--- a/docs/cmd/flux_delete_source.md
+++ b/docs/cmd/flux_delete_source.md
@@ -15,6 +15,7 @@ The delete source sub-commands delete sources.
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
   -s, --silent              delete resource without asking for confirmation
diff --git a/docs/cmd/flux_delete_source_bucket.md b/docs/cmd/flux_delete_source_bucket.md
index f4045d18..3d437878 100644
--- a/docs/cmd/flux_delete_source_bucket.md
+++ b/docs/cmd/flux_delete_source_bucket.md
@@ -27,6 +27,7 @@ flux delete source bucket [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
   -s, --silent              delete resource without asking for confirmation
diff --git a/docs/cmd/flux_delete_source_git.md b/docs/cmd/flux_delete_source_git.md
index 287e61a1..a2dc1cb2 100644
--- a/docs/cmd/flux_delete_source_git.md
+++ b/docs/cmd/flux_delete_source_git.md
@@ -27,6 +27,7 @@ flux delete source git [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
   -s, --silent              delete resource without asking for confirmation
diff --git a/docs/cmd/flux_delete_source_helm.md b/docs/cmd/flux_delete_source_helm.md
index cd3aed25..2063fb45 100644
--- a/docs/cmd/flux_delete_source_helm.md
+++ b/docs/cmd/flux_delete_source_helm.md
@@ -27,6 +27,7 @@ flux delete source helm [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
   -s, --silent              delete resource without asking for confirmation
diff --git a/docs/cmd/flux_export.md b/docs/cmd/flux_export.md
index 4430bc11..434810a8 100644
--- a/docs/cmd/flux_export.md
+++ b/docs/cmd/flux_export.md
@@ -16,6 +16,7 @@ The export sub-commands export resources in YAML format.
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_export_alert-provider.md b/docs/cmd/flux_export_alert-provider.md
index 590759f2..be1452ad 100644
--- a/docs/cmd/flux_export_alert-provider.md
+++ b/docs/cmd/flux_export_alert-provider.md
@@ -31,6 +31,7 @@ flux export alert-provider [name] [flags]
 
 ```
       --all                 select all resources
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_export_alert.md b/docs/cmd/flux_export_alert.md
index c8bc4e85..97891971 100644
--- a/docs/cmd/flux_export_alert.md
+++ b/docs/cmd/flux_export_alert.md
@@ -31,6 +31,7 @@ flux export alert [name] [flags]
 
 ```
       --all                 select all resources
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_export_helmrelease.md b/docs/cmd/flux_export_helmrelease.md
index 68c2d93c..9e22666d 100644
--- a/docs/cmd/flux_export_helmrelease.md
+++ b/docs/cmd/flux_export_helmrelease.md
@@ -31,6 +31,7 @@ flux export helmrelease [name] [flags]
 
 ```
       --all                 select all resources
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_export_kustomization.md b/docs/cmd/flux_export_kustomization.md
index 6e635f8d..c201ce24 100644
--- a/docs/cmd/flux_export_kustomization.md
+++ b/docs/cmd/flux_export_kustomization.md
@@ -31,6 +31,7 @@ flux export kustomization [name] [flags]
 
 ```
       --all                 select all resources
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_export_receiver.md b/docs/cmd/flux_export_receiver.md
index a9544316..19e6e423 100644
--- a/docs/cmd/flux_export_receiver.md
+++ b/docs/cmd/flux_export_receiver.md
@@ -31,6 +31,7 @@ flux export receiver [name] [flags]
 
 ```
       --all                 select all resources
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_export_source.md b/docs/cmd/flux_export_source.md
index 7ab2d58d..e24c8d5d 100644
--- a/docs/cmd/flux_export_source.md
+++ b/docs/cmd/flux_export_source.md
@@ -17,6 +17,7 @@ The export source sub-commands export sources in YAML format.
 
 ```
       --all                 select all resources
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_export_source_bucket.md b/docs/cmd/flux_export_source_bucket.md
index df5ad19c..7394f971 100644
--- a/docs/cmd/flux_export_source_bucket.md
+++ b/docs/cmd/flux_export_source_bucket.md
@@ -31,6 +31,7 @@ flux export source bucket [name] [flags]
 
 ```
       --all                 select all resources
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_export_source_git.md b/docs/cmd/flux_export_source_git.md
index df2419fc..a50f1b94 100644
--- a/docs/cmd/flux_export_source_git.md
+++ b/docs/cmd/flux_export_source_git.md
@@ -31,6 +31,7 @@ flux export source git [name] [flags]
 
 ```
       --all                 select all resources
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_export_source_helm.md b/docs/cmd/flux_export_source_helm.md
index f4172bf3..3c33da82 100644
--- a/docs/cmd/flux_export_source_helm.md
+++ b/docs/cmd/flux_export_source_helm.md
@@ -31,6 +31,7 @@ flux export source helm [name] [flags]
 
 ```
       --all                 select all resources
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_get.md b/docs/cmd/flux_get.md
index 794eceea..9da67448 100644
--- a/docs/cmd/flux_get.md
+++ b/docs/cmd/flux_get.md
@@ -16,6 +16,7 @@ The get sub-commands print the statuses of sources and resources.
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_get_alert-providers.md b/docs/cmd/flux_get_alert-providers.md
index e570bf60..dc6c6363 100644
--- a/docs/cmd/flux_get_alert-providers.md
+++ b/docs/cmd/flux_get_alert-providers.md
@@ -28,6 +28,7 @@ flux get alert-providers [flags]
 
 ```
   -A, --all-namespaces      list the requested object(s) across all namespaces
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_get_alerts.md b/docs/cmd/flux_get_alerts.md
index 7afda065..95ad7672 100644
--- a/docs/cmd/flux_get_alerts.md
+++ b/docs/cmd/flux_get_alerts.md
@@ -28,6 +28,7 @@ flux get alerts [flags]
 
 ```
   -A, --all-namespaces      list the requested object(s) across all namespaces
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_get_helmreleases.md b/docs/cmd/flux_get_helmreleases.md
index aec7ab80..9a7bc66c 100644
--- a/docs/cmd/flux_get_helmreleases.md
+++ b/docs/cmd/flux_get_helmreleases.md
@@ -28,6 +28,7 @@ flux get helmreleases [flags]
 
 ```
   -A, --all-namespaces      list the requested object(s) across all namespaces
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_get_kustomizations.md b/docs/cmd/flux_get_kustomizations.md
index 08f35b5b..f4a2fd42 100644
--- a/docs/cmd/flux_get_kustomizations.md
+++ b/docs/cmd/flux_get_kustomizations.md
@@ -28,6 +28,7 @@ flux get kustomizations [flags]
 
 ```
   -A, --all-namespaces      list the requested object(s) across all namespaces
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_get_receivers.md b/docs/cmd/flux_get_receivers.md
index 23b4f8d1..94d27afa 100644
--- a/docs/cmd/flux_get_receivers.md
+++ b/docs/cmd/flux_get_receivers.md
@@ -28,6 +28,7 @@ flux get receivers [flags]
 
 ```
   -A, --all-namespaces      list the requested object(s) across all namespaces
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_get_sources.md b/docs/cmd/flux_get_sources.md
index 44fc03f9..34f61be4 100644
--- a/docs/cmd/flux_get_sources.md
+++ b/docs/cmd/flux_get_sources.md
@@ -16,6 +16,7 @@ The get source sub-commands print the statuses of the sources.
 
 ```
   -A, --all-namespaces      list the requested object(s) across all namespaces
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_get_sources_bucket.md b/docs/cmd/flux_get_sources_bucket.md
index c5e39d1f..352bcc37 100644
--- a/docs/cmd/flux_get_sources_bucket.md
+++ b/docs/cmd/flux_get_sources_bucket.md
@@ -28,6 +28,7 @@ flux get sources bucket [flags]
 
 ```
   -A, --all-namespaces      list the requested object(s) across all namespaces
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_get_sources_git.md b/docs/cmd/flux_get_sources_git.md
index 41d35cb7..ceb22ad3 100644
--- a/docs/cmd/flux_get_sources_git.md
+++ b/docs/cmd/flux_get_sources_git.md
@@ -28,6 +28,7 @@ flux get sources git [flags]
 
 ```
   -A, --all-namespaces      list the requested object(s) across all namespaces
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_get_sources_helm.md b/docs/cmd/flux_get_sources_helm.md
index c1231319..69e5bbf4 100644
--- a/docs/cmd/flux_get_sources_helm.md
+++ b/docs/cmd/flux_get_sources_helm.md
@@ -28,6 +28,7 @@ flux get sources helm [flags]
 
 ```
   -A, --all-namespaces      list the requested object(s) across all namespaces
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_install.md b/docs/cmd/flux_install.md
index 99eaba15..fbdab64f 100644
--- a/docs/cmd/flux_install.md
+++ b/docs/cmd/flux_install.md
@@ -47,6 +47,7 @@ flux install [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_reconcile.md b/docs/cmd/flux_reconcile.md
index feb9525d..82434e5f 100644
--- a/docs/cmd/flux_reconcile.md
+++ b/docs/cmd/flux_reconcile.md
@@ -15,6 +15,7 @@ The reconcile sub-commands trigger a reconciliation of sources and resources.
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_reconcile_alert-provider.md b/docs/cmd/flux_reconcile_alert-provider.md
index e8001f29..3c01e048 100644
--- a/docs/cmd/flux_reconcile_alert-provider.md
+++ b/docs/cmd/flux_reconcile_alert-provider.md
@@ -27,6 +27,7 @@ flux reconcile alert-provider [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_reconcile_alert.md b/docs/cmd/flux_reconcile_alert.md
index b04a8879..0d955dbd 100644
--- a/docs/cmd/flux_reconcile_alert.md
+++ b/docs/cmd/flux_reconcile_alert.md
@@ -27,6 +27,7 @@ flux reconcile alert [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_reconcile_helmrelease.md b/docs/cmd/flux_reconcile_helmrelease.md
index 4daa63aa..38424bb7 100644
--- a/docs/cmd/flux_reconcile_helmrelease.md
+++ b/docs/cmd/flux_reconcile_helmrelease.md
@@ -32,6 +32,7 @@ flux reconcile helmrelease [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_reconcile_kustomization.md b/docs/cmd/flux_reconcile_kustomization.md
index 068b091d..ff838cac 100644
--- a/docs/cmd/flux_reconcile_kustomization.md
+++ b/docs/cmd/flux_reconcile_kustomization.md
@@ -32,6 +32,7 @@ flux reconcile kustomization [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_reconcile_receiver.md b/docs/cmd/flux_reconcile_receiver.md
index a53a034f..f6ef4c13 100644
--- a/docs/cmd/flux_reconcile_receiver.md
+++ b/docs/cmd/flux_reconcile_receiver.md
@@ -27,6 +27,7 @@ flux reconcile receiver [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_reconcile_source.md b/docs/cmd/flux_reconcile_source.md
index 8a175616..c1f2d9a6 100644
--- a/docs/cmd/flux_reconcile_source.md
+++ b/docs/cmd/flux_reconcile_source.md
@@ -15,6 +15,7 @@ The reconcile source sub-commands trigger a reconciliation of sources.
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_reconcile_source_bucket.md b/docs/cmd/flux_reconcile_source_bucket.md
index 679c74ab..33dd2eba 100644
--- a/docs/cmd/flux_reconcile_source_bucket.md
+++ b/docs/cmd/flux_reconcile_source_bucket.md
@@ -27,6 +27,7 @@ flux reconcile source bucket [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_reconcile_source_git.md b/docs/cmd/flux_reconcile_source_git.md
index 6a2edf0d..52d77492 100644
--- a/docs/cmd/flux_reconcile_source_git.md
+++ b/docs/cmd/flux_reconcile_source_git.md
@@ -27,6 +27,7 @@ flux reconcile source git [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_reconcile_source_helm.md b/docs/cmd/flux_reconcile_source_helm.md
index ce221c42..9b4fe561 100644
--- a/docs/cmd/flux_reconcile_source_helm.md
+++ b/docs/cmd/flux_reconcile_source_helm.md
@@ -27,6 +27,7 @@ flux reconcile source helm [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_resume.md b/docs/cmd/flux_resume.md
index a61d4ebf..ad74fb86 100644
--- a/docs/cmd/flux_resume.md
+++ b/docs/cmd/flux_resume.md
@@ -15,6 +15,7 @@ The resume sub-commands resume a suspended resource.
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_resume_alert.md b/docs/cmd/flux_resume_alert.md
index 13efa81b..3ce26ded 100644
--- a/docs/cmd/flux_resume_alert.md
+++ b/docs/cmd/flux_resume_alert.md
@@ -28,6 +28,7 @@ flux resume alert [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_resume_helmrelease.md b/docs/cmd/flux_resume_helmrelease.md
index 3905b5ef..cd9628eb 100644
--- a/docs/cmd/flux_resume_helmrelease.md
+++ b/docs/cmd/flux_resume_helmrelease.md
@@ -28,6 +28,7 @@ flux resume helmrelease [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_resume_kustomization.md b/docs/cmd/flux_resume_kustomization.md
index a0a6f898..a3b0d13f 100644
--- a/docs/cmd/flux_resume_kustomization.md
+++ b/docs/cmd/flux_resume_kustomization.md
@@ -28,6 +28,7 @@ flux resume kustomization [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_resume_receiver.md b/docs/cmd/flux_resume_receiver.md
index 7e293ca4..860f0120 100644
--- a/docs/cmd/flux_resume_receiver.md
+++ b/docs/cmd/flux_resume_receiver.md
@@ -28,6 +28,7 @@ flux resume receiver [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_suspend.md b/docs/cmd/flux_suspend.md
index 0b49574a..044c0805 100644
--- a/docs/cmd/flux_suspend.md
+++ b/docs/cmd/flux_suspend.md
@@ -15,6 +15,7 @@ The suspend sub-commands suspend the reconciliation of a resource.
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_suspend_alert.md b/docs/cmd/flux_suspend_alert.md
index 8a0f6ff4..4315fbd1 100644
--- a/docs/cmd/flux_suspend_alert.md
+++ b/docs/cmd/flux_suspend_alert.md
@@ -27,6 +27,7 @@ flux suspend alert [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_suspend_helmrelease.md b/docs/cmd/flux_suspend_helmrelease.md
index ea7d9884..a3e0b564 100644
--- a/docs/cmd/flux_suspend_helmrelease.md
+++ b/docs/cmd/flux_suspend_helmrelease.md
@@ -27,6 +27,7 @@ flux suspend helmrelease [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_suspend_kustomization.md b/docs/cmd/flux_suspend_kustomization.md
index 2844a867..e85e2a86 100644
--- a/docs/cmd/flux_suspend_kustomization.md
+++ b/docs/cmd/flux_suspend_kustomization.md
@@ -27,6 +27,7 @@ flux suspend kustomization [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_suspend_receiver.md b/docs/cmd/flux_suspend_receiver.md
index 0737d308..84e87c07 100644
--- a/docs/cmd/flux_suspend_receiver.md
+++ b/docs/cmd/flux_suspend_receiver.md
@@ -27,6 +27,7 @@ flux suspend receiver [name] [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/docs/cmd/flux_uninstall.md b/docs/cmd/flux_uninstall.md
index 6cf4d08c..e0c72bc9 100644
--- a/docs/cmd/flux_uninstall.md
+++ b/docs/cmd/flux_uninstall.md
@@ -34,6 +34,7 @@ flux uninstall [flags]
 ### Options inherited from parent commands
 
 ```
+      --context string      kubernetes context to use
       --kubeconfig string   path to the kubeconfig file (default "~/.kube/config")
   -n, --namespace string    the namespace scope for this operation (default "flux-system")
       --timeout duration    timeout for this operation (default 5m0s)
diff --git a/internal/utils/utils.go b/internal/utils/utils.go
index afecd774..e51ee718 100644
--- a/internal/utils/utils.go
+++ b/internal/utils/utils.go
@@ -124,11 +124,19 @@ func ExecTemplate(obj interface{}, tmpl, filename string) error {
 	return file.Sync()
 }
 
-func KubeClient(kubeConfigPath string) (client.Client, error) {
+func KubeClient(kubeConfigPath string, kubeContext string) (client.Client, error) {
 	configFiles := SplitKubeConfigPath(kubeConfigPath)
+	configOverrides := clientcmd.ConfigOverrides{}
+
+	if len(kubeContext) > 0 {
+		configOverrides.CurrentContext = kubeContext
+	}
+
 	cfg, err := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(
 		&clientcmd.ClientConfigLoadingRules{Precedence: configFiles},
-		&clientcmd.ConfigOverrides{}).ClientConfig()
+		&configOverrides,
+	).ClientConfig()
+
 	if err != nil {
 		return nil, fmt.Errorf("kubernetes client initialization failed: %w", err)
 	}
-- 
GitLab