Skip to content

Instantly share code, notes, and snippets.

@HairyMike
Last active August 29, 2023 13:05
Show Gist options
  • Save HairyMike/9c549b09c45a29bb58eb8c7f4818b3ee to your computer and use it in GitHub Desktop.
Save HairyMike/9c549b09c45a29bb58eb8c7f4818b3ee to your computer and use it in GitHub Desktop.
Handy aliases
# These aliases depend on the following: az-cli, gum, kubectx, kubens
# Choose your Azure Account
alias azacc='choice=$(az account list -o tsv --query "[].name" | gum choose --selected="$(az account show --query "name" -o tsv)") && az account set --name "$choice"'
# Choose your Kubernetes Context
alias kctx='choice=$(kubectx | gum choose --selected=$(kubectx -c)) && kubectx "$choice"'
# Choose your Kubernetes Namespace
alias kns='choice=$(kubens | gum choose --selected=$(kubens -c)) && kubens "$choice"'
# Start bash shell on a Kubernetes Pod
alias ksh='choice=$(kubectl get pods -oname | gum filter) && kubectl exec -it "$choice" -- bash'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment