Skip to content

Instantly share code, notes, and snippets.

@sakurai-youhei
Last active November 5, 2022 14:46
Show Gist options
  • Save sakurai-youhei/429d53d338dbb6e6adfc0dbaf0dc38ac to your computer and use it in GitHub Desktop.
Save sakurai-youhei/429d53d338dbb6e6adfc0dbaf0dc38ac to your computer and use it in GitHub Desktop.
Aliases to start/end an isolated session on a temporal config for kubectl
alias kcfork='install -m 600 $HOME/.kube/config $HOME/.kube/config-PID$$; export KUBECONFIG=$HOME/.kube/config-PID$$'
alias kcback='rm -f $HOME/.kube/config-PID$$; unset KUBECONFIG'
# You can start an isolated session on a temporal config by `kcfork`, do whatever you want like switching contexts, and end the session by `kcback`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment