question: custom kubeconfig from cli argument
glebsts opened this issue · comments
Hello,
for my setup I use multiple kubeconfig files a'la
kubectl --kubeconfig test-context.yaml get ns
or kubectl --kubeconfig dev-context.yaml get ns
, each defining own set of contexts. There might be aliases set a'la kubectltest
or kubectldev
to speed things up, as I use different contexts on regular basis. Reason for not putting them into single default kubeconfig is that clusters get regenerated sometimes and it is easier for me to download current config from Rancher in case of update rather then trying to merge them into single file (default homedir kubeconfig has configs for e.g. my local k8s context/cluster etc).
I am trying to use rbac-tool
and cannot combine it with specific kubeconfig. There is --cluster-context
cli switch, but it works inside current (default) contexts, and I want my specific config.
If I use kubectl --kubeconfig some.yaml rbac-tool viz
it says flags cannot be placed before plugin name: --kubeconfig
.
What am I doing wrong and how can I make it work?
Thanks @glebsts
Indeed --cluster-context
works against the default kubeconfig file.
Did you try to override kubeconfig file using KUBECONFIG env variable ?
Thanks, @gadinaor-r7 , will try later. That would be a workaround. Would you accept PR with new flag support?
Sure @glebsts