CLI doesn't support kubeconfig flag
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)
hmm... it requires the env var for KUBECONFIG... but your comment makes sense.
We will look into this.
In case someone wants to help with this... here are more details:
- 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
kubeconfigflag. (and perhaps that is the solution... perhaps we should take over that flag as a plugin) - 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
- 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.