kuttl icon indicating copy to clipboard operation
kuttl copied to clipboard

CLI doesn't support kubeconfig flag

Open nveenjain opened this issue 5 years ago • 2 comments

What happened: I was going through kuttl, and was trying to run kuttl on live cluster, but the --kubeconfig flag is not longer supported.

What you expected to happen: kuttl should be able to take kubeconfig from CLI

How to reproduce it (as minimally and precisely as possible): run kuttl command with --kubeconfig flag

Anything else we need to know?: If i set environment variable $KUBECONFIG, everything seems to be working...

Environment:

  • Kubernetes version (use kubectl version):v1.17.3
  • KUTTL version (use kubectl kuttl version):0.4.0
  • Cloud provider or hardware configuration:
  • OS (e.g. from /etc/os-release):Ubuntu 18.04.3 LTS (Bionic Beaver)

nveenjain avatar Jun 08 '20 09:06 nveenjain

hmm... it requires the env var for KUBECONFIG... but your comment makes sense.
We will look into this.

kensipe avatar Jul 17 '20 19:07 kensipe

In case someone wants to help with this... here are more details:

  1. kubectl plugins don't really pass context... the flag that is being referenced here is the kubectl global flag. kuttl itself does NOT have a kubeconfig flag. (and perhaps that is the solution... perhaps we should take over that flag as a plugin)
  2. kuttl uses controller-runtime for cluster config... which is designed for in-cluster config for kube connectivity. It does look for KUBE_CONFIG... thus kuttl uses KUBE_CONFIG
  3. warn: kuttl also (depending on type of startup) creates a kubeconfig file in the CWD, which is used for test and test setup... in particular calls to commands (in kuttl tests) that call kubectl need to connect to the cluster under test (without changing the developers local context).

So the issue is kubectl has a --kubeconfig flag to specify the preferred cluster. kuttl is unaware of this and context is not provided to plugins (which is a kubectl plugin deficiency). The act of writing up these details leads me to believe that kuttl may need to highjack the --kubeconfig global flag. I can't see a reason for that fail.

kensipe avatar Jul 17 '20 19:07 kensipe