corneliusweig / konfig Goto Github PK
View Code? Open in Web Editor NEWkonfig helps to merge, split or import kubeconfig files
License: Apache License 2.0
konfig helps to merge, split or import kubeconfig files
License: Apache License 2.0
kubectl konfig import --save ~/.kube/foo.config
seems expanding the content of file which is not expected.
# foo.config
users:
- name: vault-user
user:
client-certificate: client.crt
client-key: client
is imported as
users:
- name: vault-user
user:
client-certificate: <content of client.crt>
client-key: <content of client>
This is not expected since the certs generated by vault are temporary. It would be better to import it as is (the filename).
Hi, it would be nice to be offered a flag like --force|-f
to make sure an input config's content will overwrite any existing entries.
I just installed the plugin but kubectl konfig import --save new-config.yaml
command gives the following error:
error: open /Users/emre.savci/.minikube/client.crt: no such file or directory
I am on macOS
Hey folks, this is just a share of info for those that want to use the agnoster oh my zsh theme. Make a copy of the theme file:
cp ~/.oh-my-zsh/themes/agnoster.zsh-theme ~/.oh-my-zsh/themes/agnoster-custom.zsh-theme
Then open the agnoster-custom.zsh-theme in your favorite code editor and replace the prompt_aws function by:
prompt_aws() {
[[ -z "$ZSH_KUBECTL_PROMPT" || "$SHOW_AWS_PROMPT" = false ]] && return
case "$ZSH_KUBECTL_PROMPT" in
*-prod|*production*) prompt_segment red yellow "kube: $ZSH_KUBECTL_PROMPT" ;;
*) prompt_segment green black "kube: $ZSH_KUBECTL_PROMPT" ;;
esac
}
Or if you want to remove the "/default" like me, it can be done with awk, in that manner:
prompt_aws() {
[[ -z "$ZSH_KUBECTL_PROMPT" || "$SHOW_AWS_PROMPT" = false ]] && return
case "$ZSH_KUBECTL_PROMPT" in
*-prod|*production*) prompt_segment red yellow "kube: $ZSH_KUBECTL_PROMPT" ;;
*) prompt_segment green black "kube: $ZSH_KUBECTL_PROMPT" | awk 'BEGIN { ORS=" " }; { print substr( $0, 1, length($0)-8 ) }' ;;
esac
}
That way, we are hi-jacking its AWS info functionality. Of course, don't forget to change the theme name in your .zshrc
from agnoster to agnoster-custom!
Enjoy!
Thanks for the handy plugin. Please enable the option to delete/remove configs too
In other words, something similar to the below commands
kubectl config delete-cluster my-cluster
kubectl config delete-context my-cluster-context
kubectl config unset users.my-cluster-admin
This subcommand should delete the given context(s) from the kubeconfig and print the result to stdout. Maybe also support a --save
flag to update ~/.kube/config
in-place.
Kubectl allows to minify a config for a given context name. However, it only accepts a single named context. konfig-merge
should learn to extract a minimal kubeconfig for an arbitrary number of contexts.
I tried to import an kubeconfig file "kubeconfig--xxx-xxx--xxx-x.yaml" but encountered the following error:
konfig import "kubeconfig--xxx-xxx--xxx-x.yaml"
error: unrecognized flag "kubeconfig--xxx-xxx--xxx-x.yaml"
STR:
kubectl konfig import ingress-test-config.yaml
error: unrecognized flag "ingress-cluster.yaml"
It probably has something to do with how you get input flags.
-- Very happy that I found this tool! Thanks for creating it!
Actually...
kubectl konfig import -s ingresscluster.yaml
or kubectl konfig import --save ingresscluster.yaml
also fails with:
error: unrecognized flag "-s ingresscluster.yaml"
I am using "kubectl get rs myapp-replicaset -o yaml > new-replicaset.yaml" command to copy code into new file getting error "error: write /dev/stdout: permission denied" in VSCode editor terminal but it is working file in Ubuntu main terminal
Hello everyone,
I was trying to import the kubeconfig from /etc/rancher/k3s/k3s.yaml to my ~/.kube/config.
Unfortunately /etc/rancher/k3s/k3s.yaml was in 600 so I could not read it. Konfig edited my ~/.kube/config and had empty it.
My KUBECONFIG is now empty and I lost my access to clusters I had.
โ kubectl konfig import -s /etc/rancher/k3s/k3s.yaml
error: error loading config file "/etc/rancher/k3s/k3s.yaml": open /etc/rancher/k3s/k3s.yaml: permission denied
Is that a miss-usage from me ?
Regards.
This should support the various options and understand the positional context.
Where applicable, it should also suggest context names from the kubeconfig files.
Goal: at the very least support bash and zsh
When merging two contexts which reference the same user name (though different users) the resulting kubecfg drops one of those users and the corresponding context can not authenticate.
Suggestion: Detect duplicate user names (i.e. same name but different data) and rename them on import (e.g. to $context-$user
).
#37
The above issue is similar to mine, except instead of installing with snap, I'm installing with krew.
brice@brice-virtual-machine:~/Desktop$ kubectl konfig import -s kubeconfig-us-east-1kubectl
error: write /dev/stdout: permission denied
However, running kubectl konfig does not produce this issue. Since kubectl konfig
version does not seem to be a command, i cannot provide that detail, however my environment is ubuntu with the following kubectl version
output:
Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.2", GitCommit:"8b5a19147530eaac9476b0ab82980b4088bbc1b2", GitTreeState:"clean", BuildDate:"2021-09-16T02:43:21Z", GoVersion:"go1.16.7", Compiler:"gc", Platform:"linux/amd64"}
Here's the debug output
+ TMPFILES=()
+ declare -a TMPFILES
+ trap cleanup EXIT
+ main import -s kubeconfig-us-east-1kubectl krew
+ hash kubectl
+ KUBECTL=kubectl
+ [[ 4 -eq 0 ]]
+ case "$1" in
+ import_ctx -s kubeconfig-us-east-1kubectl krew
+ tmpcfgs=()
+ declare -a tmpcfgs
+ local tmpcfg
+ local tmpinputcfg=
+ local out=
+ local arg=
++ mktemp konfig_XXXXXX
+ tmpcfg=konfig_rj3LF8
+ TMPFILES+=("$tmpcfg")
+ tmpcfgs+=("$tmpcfg")
+ for OPT in "$@"
+ case $OPT in
+ out=/home/brice/.kube/config
+ shift
+ for OPT in "$@"
+ case $OPT in
+ for OPT in "$@"
+ case $OPT in
+ kubectl config view --raw
error: write /dev/stdout: permission denied
+ cleanup
+ [[ 1 -gt 0 ]]
+ rm -- konfig_rj3LF8```
Have a bit of an delay in voice apps like discord, its between 0,2 and 0,5 seconds.
Is there a possibility to reduce this delay, e.g. assign more cpu oder gpu power?
The subcommand should open an inactive menu (eg fzf) where one can select the currently active kubeconfig files. The effect should be to export the KUBECONFIG=cfg1:cfg2
variable in the current shell. When given a flag (--save/-s
) the setting should be persisted in a shell_profile
file.
I am installing the plugin via krew
and when I try kubectl konfig help
I get the following error when running from cmd or powershell
fork/exec C:\Users\<username>\.krew\bin\kubectl-konfig.exe: This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher.
I tried gitbash, but same issue happens if I run using kubectl konfig
but it works if I run the exe directly.
Does not save the config, gives an error.
kubectl konfig import --save ~/.kube/192.168.0.100.conf
mktemp: mkstemp failed on konfig_yuisHv: Read-only file system
Apparently, the plugin mechanism on windows does not allow to call bash scripts. Thus, we need to drop the distribution method for windows.
References:
Krew tests need a plugin with a small tarball, like konfig
. However, the krew install currently uses the manually created tarballs for installation, which is bad because the krew tests will skew the download statistics for konfig
. This does not happen when using the github tarball.
Therefore: switch the krew installation method to the standard tarball and make sure that the help text is updated accordingly.
Bonus: keep unnecessary files out of the tarball (does GH support that?)
k konfig import -s config.yaml
error: write /dev/stdout: permission denied
Currently, "split" is an alias for "export". However, the connotation of split is more that the two outcomes have disjoint contexts instead of one being a subset of the other.
Maybe split should really do a split, so that the split out context is no longer contained in the input kubeconfig file.
TODO: work out how this should behave with multiple input kubeconfigs when KUBECONFIG=cfg1:cfg2...
.
The documentation talks about an extract subcommand, even in the command line examples, while the current name of the subcommand is export.
$ kubectl konfig split microk8s
error: write /dev/stdout: permission denied
Linux. kubectl
1.17.3 from Snap. Plugin v0.2.2.
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.