Last active
February 8, 2023 18:29
-
-
Save BorysVrublevskyi/9c010484d4c6772540884aa084db70c4 to your computer and use it in GitHub Desktop.
Script to import all *.yaml Kubernetes configs. Works only in the current terminal.
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
# export KUBECONFIG=$(for YAML in $(find ${HOME}/.kube -name '*.yaml') ; do echo -n ":${YAML}"; done) # bash example | |
function importctx { | |
$list=Get-ChildItem -Path $HOME\.kube\ -Filter *.yaml -File -Name #-Recurse | |
$env:KUBECONFIG="$HOME\.kube\config" | |
foreach ($contect in $list) { | |
$env:KUBECONFIG=("$env:KUBECONFIG;$HOME\.kube\$contect") | |
}} | |
importctx | |
# now run k9s, kubectl, whatever) | |
# To have this changes globally, run in PowerShell and save this code with: | |
# Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser | |
# notepad $profile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment