danielfoehrkn / kubeswitch Goto Github PK
View Code? Open in Web Editor NEWThe kubectx for operators.
Home Page: https://danielfoehrkn.medium.com/the-case-of-kubeswitch-aff4b6a04ae7
License: Apache License 2.0
The kubectx for operators.
Home Page: https://danielfoehrkn.medium.com/the-case-of-kubeswitch-aff4b6a04ae7
License: Apache License 2.0
We need a --version
flag to identify the currently used kubeswitch
version.
i tried switch namespace default
, it didn't work. Error: context with name "default" not found. i searched the issues list, found i'd use switch ns
The kubectx for operators.
Usage:
switch [flags]
switch [command]
Available Commands:
alias Create an alias for a context. Use ALIAS=CONTEXT_NAME
clean Cleans all temporary kubeconfig files
completion Generate the autocompletion script for the specified shell
gardener gardener specific commands
help Help about any command
history Switch to any previous tuple {context,namespace} from the history
hooks Run configured hooks
list-contexts List all available contexts without fuzzy search
namespace Change the current namespace
set-context Switch to context name provided as first argument
set-last-context Switch to the last used context from the history
set-previous-context Switch to the previous context from the history
version show Switch Version info
Flags:
--config-path string path on the local filesystem to the configuration file. (default "/Users/d060239/.kube/switch-config.yaml")
--debug show debug logs
-h, --help help for switch
--kubeconfig-name string only shows kubeconfig files with this name. Accepts wilcard arguments "*" and "?". Defaults to "config". (default "config")
--kubeconfig-path string path to be recursively searched for kubeconfigs. Can be a file or a directory on the local filesystem or a path in Vault. (default "$HOME/.kube/config")
--no-index stores do not read from index files. The index is refreshed.
--show-preview show preview of the selected kubeconfig. Possibly makes sense to disable when using vault as the kubeconfig store to prevent excessive requests against the API. (default true)
--state-directory string path to the local directory used for storing internal state. (default "/Users/d060239/.kube/switch-state")
--store string the backing store to be searched for kubeconfig files. Can be either "filesystem" or "vault" (default "filesystem")
--vault-api-address string the API address of the Vault store. Overrides the default "vaultAPIAddress" field in the SwitchConfig. This flag is overridden by the environment variable "VAULT_ADDR".
-v, --version version for switch
Hi,
the following configuration shows the .kube
prefix but it should not:
$ switch version
Switch:
version : v0.4.5
build date : 2021-05-22
go version : go1.15.12
go compiler : gc
platform : linux/amd64
$ cat ~/.kube/switch-config.yaml
kind: SwitchConfig
version: v1alpha1
showPreview: false
kubeconfigStores:
- kind: filesystem
id: local
refreshIndexAfter: 3h
showPrefix: false
paths:
- ~/.kube/config
$switch
If I remove the id: local
it works as expected.
Cheers
Robert
Currently:
❯ find .kube/configs -type f
.kube/configs/ha-edge-385.yaml
.kube/configs/vm-k3s-only.yaml
❯ cat .kube/switch-config.yaml
kind: SwitchConfig
version: v1alpha1
kubeconfigStores:
- kind: filesystem
kubeconfigName: "*.yaml"
paths:
- /Users/eminguez/.kube/configs/
- /Users/eminguez/.kube/config
❯ switch list-contexts
configs/default
configs/default
Ideally:
❯ switch list-contexts
configs/default (ha-edge-385.yaml)
configs/default (vm-k3s-only.yaml)
Running as readme suggests only shows help output ?
$ switch --kubeconfig-directory ~/.kube
Simple tool for switching between kubeconfig contexts. The kubectx build for people with a lot of kubeconfigs.
Usage:
switch [flags]
switch [command]
Available Commands:
clean Cleans all temporary kubeconfig files
help Help about any command
hooks Runs configured hooks
Flags:
--config-directory string path to the configuration file. (default "~/.kube/switch-config.yaml")
-h, --help help for switch
--kubeconfig-name string only shows kubeconfig files with this name. Accepts wilcard arguments "*" and "?". Defaults to "config". \(default "config")
--kubeconfig-path string path to be recursively searched for kubeconfig files. Can be a directory on the local filesystem or a path in Vault. (default "~/.kube")
--show-preview show preview of the selected kubeconfig. Possibly makes sense to disable when using vault as the kubeconfig store to prevent excessive requests against the API. (default true)
--state-directory string path to the local directory used for storing internal state. (default "~/.kube/switch-state")
--store string the backing store to be searched for kubeconfig files. Can be either "filesystem" or "vault" (default "filesystem")
--vault-api-address string the API address of the Vault store.
Use "switch [command] --help" for more information about a command.
That folder contains:
$ ls ~/.kube
7ejidqmfi9-k8sca cache http-cache kubectx kubens microk8s p-boa-kube-ca switch-config.yaml t-boss-ca
and if I run switch with no arguments.. it just says 0/0 at the bottom.. Nothing to choose from :(
Hi,
I would like to ask if there is any plan to implement a possibility to set a default context for all future terminals.
Maybe something like:
$ switch --set-default
$ switch some-context --set-default
Currently the workaround for me is to type into every new terminal the following:
$ switch -
# ~/.kube/switch-config.yaml
kind: SwitchConfig
version: "v1alpha1"
kubeconfigStores:
- kind: gke
id: gke
config:
authentication:
authenticationType: gcloud
# optionally limit to certain projects in account
# projectIDs: []
switch
(Google Cloud Authorization opens in a web browser)switch
$ switch
WARN[0021] Supressed warnings during the search: 1 error occurred:
* store "gke.gke" returned an error during the search: failed to initialize store: no projects found in Google Cloud. Unable to discover GKE clusters
Error: abort
A list of GKE clusters. There are definitely some projects:
$ gcloud projects list | wc -l
5
And some GKE clusters:
$ gcloud container clusters list | wc -l
2
Kubeswitch version info:
Switch:
version : v0.7.2
build date : 2022-09-20
go version : go1.19
go compiler : gc
platform : linux/amd64
Gcloud version info:
Google Cloud SDK 404.0.0
alpha 2022.09.23
beta 2022.09.23
bq 2.0.78
bundled-python3-unix 3.9.12
core 2022.09.23
gcloud-crc32c 1.0.0
gke-gcloud-auth-plugin 0.4.0
gsutil 5.14
It seems when using switch with Rancher that the scoped tokens that get created don't have an expiry date. It would be a nice security property to have switch create token with let's say a day of validity since it can create new ones with the bearer token anyway.
This way one could create a bearer token that lasts for a month or a year and protect that one especially and at the same time have kind of temporary credentials be created and used by switch that, if compromised, expire very fast by themself.
I'm curious what other might think about that proposal.
PS: Thanks for the awesome tool, it makes my daily work so much easier! 🙇
When executing Switcher in whatever dir on my MacOS I get the following err:
Error: the configured kubeconfig directory {"/Users/USERNAME/.kube/config" "filesystem"} does not exist
the configured kubeconfig directory {"/Users/USERNAME/.kube/config" "filesystem"} does not exist
! When there is no default Kubeconfig file in the ~/.kube/
directory (meaning the config file).
So. Is it a requirement to have a default Kubeconfig config file in ~/.kube
for things to work?
From reading Configure Kubeconfig stores I do not get the impression that this is the case.
I can get things to work by having whatever Kubeconfig config file in the ~/.kube/
folder. But, I'd rather not.
Looking forward to some pointers. Thank you 😄
Hi,
I'm currently using direnv to automatically set the kubeconfig context when entering a directory. This works by exporting KUBECONFIG
with direnv.
However, afaik this is not possible with kubeswitch because kubeswitch generates tmp config files like ~/.kube/.switch_tmp/config.1692710140.tmp
which don't contain the context name (and are eventually garbage collected ?). It would be nice if kubeswitch would create/update kubeconfig files including at least the name of the context and can be used permanently.
I wonder if such feature is in the scope of kubeswitch.
This is how other projects relate to this issue:
KUBECONFIG=~/.kube/kubesess/cache/mastodon-dev:/home/varac/.kube/config
but don't have hook supporthttps://github.com/danielfoehrKn/kubeswitch/blob/master/docs/installation.md
https://github.com/danielfoehrKn/kubeswitch/blob/master/docs/docs/command_completion.md <- this link is not public
seems like extra docs directory were there,
correct one --> https://github.com/danielfoehrKn/kubeswitch/blob/master/docs/command_completion.md
Right now it doesn't seem like you can pass a namespace to using switch ns
. For example, if I have a namespace test
, i should be able to use switch ns test
and I will be switched over to that namespace. Right now, it pops up the search, which isn't bad. But it could be faster in the cases I know the namespace name I want to switch over to.
Hi there!
Thanks for the awesome project!
Just to make it clear, would be nice to have the LICENSE file, so far I only know from a quick look that the project is Apache 2 because of the little badge in the README.md.
Thanks!
Hi Daniel,
I'm struggling to make switcher load Gardener landscape(s) after 0.6 release. I'm aware of the new AdminKubeconfigRequest, which I have enabled at apiserver. I also tested the functionality of AdminKubeconfigRequest via creating the request manually and also via gardenlogin kubeconfig which also works.
When I downgrade back to 0.5 then gardener landscape load correctly.
Only extra output I get, when running switch with debug.
switcher --debug --no-index --show-preview=false
DEBU[0000] Using kubeconfig path from flag /Users/..../.kube/config
DEBU[0000] Added store with kind gardener and ID gardener.garden-.....
DEBU[0000] Added store with kind filesystem and ID filesystem.env-and-flag
which seem to me be that gardener being added correctly
any hint would be great
many thanks
Pavel
Or was it meant to be 0.4.2
?
Supporting Amazon EKS seems to be possible
It seems like that each region
needs to be specified when authenticating or rely on the default credentials at .aws/credentials
and .aws/config
. This makes configuration in kubeswitch
slightly more cumbersome than for GKE.
On top of that, EKS does not have a free tier for development :(
If someone uses EKS already and wants to see EKS being supported by kubeswitch
, this is your chance :)
At the company I work for we are not allowed to scan for namespaces. When I try to do so I am denied and when using kubectl
I have to pay attention not to forget the -n foo
parameter.
I gave kubeswitch a try and it seems to fail for the same reason:
2023/02/23 08:14:16 error from api: namespaces is forbidden: User "menotyou" cannot list resource "namespaces" in API group "" at the cluster scope
Using the switch config I told kubeswitch to use a single kubeconfig file. All of my kubeconfig files (I have one per cluster/context) have the namespace configured so that I only need to do something like KUBECONFIG=~/config/config1.yml kubectl get po
and can dump the -n
.
- context:
cluster: ...
user: ...
name: ...
namespace: foo
I assume that kubeswitch always scans for namespaces even if (in my scenario) this is undesired / not necessary. I really would like to use kubeswitch but I guess in the current state I can't use it. Am I right ? Or is there a workaround ?
Rancher's CLI tool allows you to run rancher cluster kubeconfig <name>
and returns a kubeconfig YAML.
CLI entrypoint is here https://github.com/rancher/cli/blob/7c7f747d32b2fe848d09dd90f95ef82bc9be25db/cmd/cluster.go#L474
That seems to call https://github.com/rancher/rancher/blob/ba4347297ef8984f629650979a1b3a470592f4da/pkg/client/generated/management/v3/zz_generated_cluster.go#L184
Not quite sure which actual URL is called behind that, but I'll look into it (and plan to PR a rancher store provider)
I started to test this from one of the first releases but have the same issue each time.
Execute switcher, expect that it had changed the context but it don't.
switcher --debug
DEBU[0000] Using kubeconfig path from flag /home/user/.kube/config
DEBU[0000] Starting search for store: filesystem store=filesystem
DEBU[0000] GetKubeconfigForPath: /home/user/.kube/config not cached store=filesystem
DEBU[0002] GetKubeconfigForPath: /home/user/.kube/config found in cache store=filesystem
/home/user/.kube/.switch_tmp/config.52797184.tmp
In this tmp file the current-context key has right value, the one that I selected.
switch version v0.7.2
bash 5.1.4(1)-release
context source: ~/.kube/config
Debian GNU/Linux 11 (bullseye)
So I've always maintained a custom KUBECONFIG=$HOME/.kube/config:$HOME/.kube/foo:$HOME/.kube/bar
. This works great for kubeswitch on the first time I run it - and then it overwrites the env var with its custom tempfile. The second time I run kubeswitch the values are lost, and only the default $HOME/.kube/config
file is shown as options of context's to switch to. I would expect it to save the KUBECONFIG value somewhere and on subsequent invocations show me all of those options.
Alternatively I can define switch-config.yaml and maintain it separately but then of course I have it maintained in two locations when I'd prefer to use the "standard" support in kubectl in some situations.
PS thanks for this tool - it scratches an itch I've had for a really long time and you've done a much nicer job implementing it than anything I was thinking to do for myself!
breaks functionality of aws eks update-kubeconfig
please add uninstall instructions.
Ability to work with multiple distinct kubeconfig directories - should be an array of directories that can be handed over to the utility.
echo $SHELL
/bin/zsh
switcher version
Switch:
version : v0.6.0
build date : 2021-12-15
go version : go1.17.4
go compiler : gc
platform : darwin/amd6
switch gke_foo-europe-west1
Error: failed to get namespace of current context: context with name "/Users/userid/.kube/config" not found
grep context -A1 /Users/userid/.kube/config
contexts:
- context:
cluster: gke_foo-europe-west1
--
when I run only switch
, the context is listed without issue.
What I'm doing wrong ?
Hi, is it possible to also support fish shell?
Currently the utility can only be configured to search for kubeconfig files with a certain name.
Make it possible to be able to specify multiple names.
$ brew -v
Homebrew 3.0.3
Homebrew/homebrew-core (git revision dc577d; last commit 2021-03-01)
Fail to install k8ctx via Homebrew:
$ brew install danielfoehrkn/k8ctx/k8ctx
==> Tapping danielfoehrkn/k8ctx
Cloning into '/usr/local/Homebrew/Library/Taps/danielfoehrkn/homebrew-k8ctx'...
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Error: Failure while executing; `git clone https://github.com/danielfoehrkn/homebrew-k8ctx /usr/local/Homebrew/Library/Taps/danielfoehrkn/homebrew-k8ctx --origin=origin` exited with 128.
Hello, I'm testing the latest kubeswitch on my Mac
$ switcher version
Switch:
version : v0.6.0
build date : 2021-12-13
go version : go1.17.4
go compiler : gc
platform : darwin/amd64
when I try to run the interactive interface to select the context to switch to, I've got the following error:
$ switcher --debug
DEBU[0000] Using kubeconfig path from flag /Users/myuser/.kube/config
DEBU[0000] Added store with kind filesystem and ID filesystem.env-and-flag
WARN[0006] failed to append context to history file: cannot open file: open /Users/myuser/.kube/.switch_history: no such file or directory
/Users/myuser/.kube/.switch_tmp/config.122399507.tmp
the interactive screen works fine, I see the list of contexts just fine and I can select the new context just fine, but when I hit enter the set the context, the error above shows up.
If I create an empty /Users/myuser/.kube/.switch_history file, then I get a different error message:
$ touch /Users/myuser/.kube/.switch_history
crmar@crmac10-lp Documents $ switcher --debug
DEBU[0000] Using kubeconfig path from flag /Users/myuser/.kube/config
DEBU[0000] Added store with kind filesystem and ID filesystem.env-and-flag
WARN[0003] failed to append context to history file: seek /Users/myuser/.kube/.switch_history: invalid argument
/Users/myuser/.kube/.switch_tmp/config.1892608840.tmp
This is the very first time I run kubeswitch, then I guess not having the .switch_history file is expected in that case.
any ideas ?
Example configuration.
config:
gardenerAPIKubeconfigPath: "~/.kube/kubeconfig/kubeconfig-garden-core.yaml"
Add a flag that allows disabling of the cache per command.
Currently, there is only one global configuration in the switch config
file.
Running as readme suggests only shows help output ?
$ switch --kubeconfig-directory ~/.kube
Simple tool for switching between kubeconfig contexts. The kubectx build for people with a lot of kubeconfigs.
Usage:
switch [flags]
switch [command]
Available Commands:
clean Cleans all temporary kubeconfig files
help Help about any command
hooks Runs configured hooks
Flags:
--config-directory string path to the configuration file. (default "~/.kube/switch-config.yaml")
-h, --help help for switch
--kubeconfig-name string only shows kubeconfig files with this name. Accepts wilcard arguments "*" and "?". Defaults to "config". \(default "config")
--kubeconfig-path string path to be recursively searched for kubeconfig files. Can be a directory on the local filesystem or a path in Vault. (default "~/.kube")
--show-preview show preview of the selected kubeconfig. Possibly makes sense to disable when using vault as the kubeconfig store to prevent excessive requests against the API. (default true)
--state-directory string path to the local directory used for storing internal state. (default "~/.kube/switch-state")
--store string the backing store to be searched for kubeconfig files. Can be either "filesystem" or "vault" (default "filesystem")
--vault-api-address string the API address of the Vault store.
Use "switch [command] --help" for more information about a command.
That folder contains:
$ ls ~/.kube
7ejidqmfi9-k8sca cache http-cache kubectx kubens microk8s p-boa-kube-ca switch-config.yaml t-boss-ca
and if I run switch with no arguments.. it just says 0/0 at the bottom.. Nothing to choose from :(
Hi!
Thanks for this tool - I only started using it but it looks very promising so far!
I was not able to find a way to get my list of available contexts appear sorted though. I mean mainly the output of switch
(for switch list-contexts
I would just pipe it to sort
, but I don't need that). Is it possible to make this list sorted?
Hello,
The Kubernetes documentation states that a colon separated list of paths is supported for the KUBECONFIG environment variable :
However kubeswitch seems to have trouble with this :
% echo $KUBECONFIG
/home/alex/.kube/configs/first.config:/home/alex/.kube/configs/second.config
% switch
Error: the configured kubeconfig directory "/home/alex/.kube/configs/first.config:/home/alex/.kube/configs/second.config" does not exist
the configured kubeconfig directory "/home/alex/.kube/configs/first.config:/home/alex/.kube/configs/second.config" does not exist
Am I doing something wrong?
Cheers,
Alexander
Instead of replacing the KUBECONFIG
with a dynamically created config, sometimes I want to explicitly set the current-context
in my existing KUBECONFIG
. This would make a nice CLI option. Maybe something like switch --set-current-context
or switch --keep-kubeconfig
Follow up to comment #18 (comment)
Please provide an option to disable the prefix of kubeconfig:
$ cat ~/.kube/config.CLEAN
apiVersion: v1
clusters:
- cluster:
insecure-skip-tls-verify: true
server: https://api.vmw.example.com:6443
name: api-vmw-example-com:6443
contexts:
- context:
cluster: api-vmw-example-com:6443
namespace: windows-container
user: kube:admin/api-vmw-example-com:6443
name: windows-container/api-vmw-example-com:6443/kube:admin
- context:
cluster: api-vmw-example-com:6443
namespace: windows-workload
user: kube:admin/api-vmw-example-com:6443
name: windows-workload/api-vmw-example-com:6443/kube:admin
current-context: demo-app/api-demo-openshift-pub:6443/admin
kind: Config
preferences: {}
users:
- name: kube:admin/api-vmw-example-com:6443
user:
token: sha256~A518ZtBiOcuyuYuYWk96-NTgZaJh_vfqomZ-SyXTNpc
$ switch --show-preview=false --kubeconfig-path ~/.kube/config.CLEAN
Thanks
Robert
$ switch --config-directory ~/.kube
Error: unknown flag: --config-path
and README says to use --kubeconfig-directory.. but thats not listed in the --help output ?
It would be very useful to be able to select a namespace when selecting a context.
There are 2 ways this could be implemented:
Is this something you would consider?
I can't seem to get switcher to work with my KV v2 secret store. Is v2 supported?
$ switcher --debug
DEBU[0000] Using kubeconfig path from flag /Users/blah/.kube/config
DEBU[0000] Added store with kind vault and ID vault.default
DEBU[0000] Added store with kind filesystem and ID filesystem.env-and-flag
WARN[0001] Supressed warnings during the search: 1 error occurred:
* store "vault.default" returned an error during the search: Error making API request.
URL: GET https://vault.blabla.net/v1/platform-kv/data/kubernetes?list=true
Code: 405. Errors:
* 1 error occurred:
* unsupported operation
Error: abort
abort%
Hi guys, thank you for this great tool.
Unfortunately there is a bug in the command shell completion
.
Here what happens:
$ switch completion
Error: context with name "completion" not found
I installed kubeswitch using homebrew, then sourced the switch.sh as described in the docs:
$ INSTALLATION_PATH=$(brew --prefix switch) && source $INSTALLATION_PATH/switch.sh
Here the version:
$ switch -v
Switch:
version : v0.7.1
build date : 2022-06-22
go version : go1.18.3
go compiler : gc
platform : darwin/amd64
Here shell info:
$ zsh --version
zsh 5.9 (x86_64-apple-darwin21.3.0)
It would be great to have this command working, so instead of being forced to manually download an additional file (scripts/_switch.bash) we could source that directly in .zshrc/.bashrc/.bash_profile
I just tried to install on my M1 Mac and received switcher: The x86_64 architecture is required for this software.
I checked the releases and found an arm64 version. Could you make that available via Homebrew?
I tried this wonderful tool. This has become everyday handy tool to switch between clusters/kubeconfigs.
But switching ns doesn't work properly
switch ns
Error: unable to list namespaces. The kubeconfig file "" does not exist
unable to list namespaces. The kubeconfig file "" does not exist%
This is important, as the gardenlogin-controller is deprecated. In the past, this controller created the Shoot kubeconfig via the ShootState as a <shoot-name>.kubeconfig
config map in the project ns in the garden.
For more information, please see here: https://github.com/gardener/gardenctl-v2/pull/149/files#
I have installed switch
from Homebrew, and when using example Rancher store config I get this error:
Error: the switch configuration file contains errors: kubeconfigStores[0].kind: Invalid value: "rancher": kind "rancher" of kubeconfig store is unknown. Valid kinds are map["azure":{} "eks":{} "filesystem":{} "gardener":{} "gke":{} "vault":{}]
brew info:
❯ brew info switch
Warning: Treating switch as a formula. For the cask, use homebrew/cask/switch
==> danielfoehrkn/switch/switch: stable 0.7.1
The kubectx for operators.
https://github.com/danielfoehrKn/kubeswitch
/opt/homebrew/Cellar/switch/0.7.1 (3 files, 17.7KB) *
Built from source on 2022-09-20 at 13:17:10
From: https://github.com/danielfoehrkn/homebrew-switch/blob/HEAD/switch.rb
==> Dependencies
Required: danielfoehrkn/switch/switcher ✔
I'm using kube-ps1 in order to show what cluster I'm connected to in my PS1 prompt. However, when I use kubeswitch/switcher to switch. I get no error. But the PS1 prompt does NOT change as well as a test with kubectl get nodes
verifies that I still see the nodes from the cluster I'm trying to switch away from.
kubeswitch
kubectx
and kubens
at the same time. Is that a problem?Looking forward to hear from you and thank you
Is there a reason why you don't provide the Windows binaries too ?
First I thought there might be some dependency that doesn't exist on Windows. But I was able to build the binary on my own and it seems to work (have to check this more thoroughly).
Or are there some known things that don't work ?
Additional remarks:
Hi,
is that only me or is kubeswitch using any shortened context name?
Here an example:
$ kubectx | grep windows-workload <===== Original kubectx
windows-workload/api-vmw-stormshift-coe-muc-redhat-com:6443/kube:admin
$ grep -B4 'windows-workload/' ~/.kube/config
- context:
cluster: api-vmw-stormshift-coe-muc-redhat-com:6443
namespace: windows-workload
user: kube:admin/api-vmw-stormshift-coe-muc-redhat-com:6443
name: windows-workload/api-vmw-stormshift-coe-muc-redhat-com:6443/kube:admin
$ switch list-contexts | grep windows
$ switch list-contexts | grep kube:admin
.kube/kube:admin
.kube/kube:admin
.kube/kube:admin
.kube/kube:admin
.kube/kube:admin
.kube/kube:admin
.kube/kube:admin
.kube/kube:admin
.kube/kube:admin
.kube/kube:admin
.kube/kube:admin
.kube/kube:admin
.kube/kube:admin
.kube/kube:admin
.kube/kube:admin
.kube/kube:admin
.kube/kube:admin
.kube/kube:admin
.kube/kube:admin
.kube/kube:admin
.kube/kube:admin
.kube/kube:admin
$
my switch configuration
kind: SwitchConfig
version: v1alpha1
kubeconfigStores:
- kind: filesystem
paths:
- ~/.kube/config
switch version
$ switch version
Switch:
version : v0.4.1
build date : 2021-03-16
go version : go1.15.8
go compiler : gc
platform : linux/amd64
I would like to see the whole context name.
Thanks for any advice
Cheers
Robert
Every time I switch my shell from one context to another I get a warning to remove the tempfile... seems like overkill or something I'd like to opt out of. I thought it was because I have alias rm='rm -i'
but I removed the alias and it still happens so I guess kubeswitch is implementing that confirmation itself.
$ switch
switched to context "foo".
$ switch
remove /Users/michael/.kube/.switch_tmp/config.2360448475.tmp? y
switched to context "bar".
It's probably also worth pointing out that if I select n
then it claims it worked anyway - looks like tmp files are just accumulating in ~/.kube/.switch_tmp
.
Today, when using the kubeconfig generated by kubeswitch with kubectl > 1.22, we get the following warning
WARNING: the gcp auth plugin is deprecated in v1.22+, unavailable in v1.25+; use gcloud instead.
To learn more, consult https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke
Please see here for more information.
Currently, the user section of the kubeconfig is generated like so:
users:
- name: gke_dev-garden-gcp
user:
auth-provider:
config:
access-token: <token>
cmd-args: config config-helper --format=json
cmd-path: /usr/local/bin/gcloud
expiry: "2022-05-17T09:39:22Z"
expiry-key: '{.credential.token_expiry}'
token-key: '{.credential.access_token}'
name: gcp
in the future it should look like so
gke-gcloud-auth-plugin
(must be installed on the client side!)users:
- name: NEW-CONFIG
user:
exec:
apiVersion: client.authentication.k8s.io/v1beta1
command: gke-gcloud-auth-plugin
installHint: Install gke-gcloud-auth-plugin for use with kubectl by following
https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke
provideClusterInfo: true
switch
is a pretty common term, which may clash with other programs (e.g. fish shell provides switch
as a shell builtin).
I think it's better to use the repo name kubeswitch
as the binary name. It seems more unified and kubeswitch
is a unique enough term on its own.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.