Last active
December 1, 2020 15:00
-
-
Save mjpitz/18e0b946b803e344bd16495316e40fa3 to your computer and use it in GitHub Desktop.
One-line dynamic KUBECONFIG per shell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Enables each Shell instance to have their own KUBECONFIG. | |
# Also aggregates all cluster contexts into a single configuration. | |
# Simply add to .bashrc or .bash_profile | |
kubeconfig="${KUBECONFIG}" | |
if [[ -z "${kubeconfig}" ]]; then | |
kubeconfig="$(mktemp):$(ls -1 ${HOME}/.kube/*.yaml | tr $'\n' ':')${HOME}/.kube/config" | |
fi | |
export KUBECONFIG="${kubeconfig}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment