Last active
November 22, 2024 12:31
-
-
Save danackerson/62c242ee858e56a78957d524923ac07c to your computer and use it in GitHub Desktop.
handy aliases
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
### GIT ### | |
alias gs='git status' | |
alias gd='git diff' | |
alias gc='git commit -am' | |
alias gp='git push' | |
### K8S ### | |
alias k='sudo kubectl' | |
alias kp='k get po' | |
alias kap='k get pods --all-namespaces -o wide' | |
alias kas='k get services --all-namespaces -o wide' | |
ksh() { | |
namespace="gitlab-managed-apps" | |
case "$#" in | |
0) echo "Usage: ksh <app> (<namespace>)" && return;; | |
2) namespace="$2";; | |
esac | |
kubectl exec -it $(kubectl get pods -n $namespace -l app="$1" -o jsonpath='{.items[0].metadata.name}') -n $namespace -- /bin/bash; | |
} | |
kl() { | |
k logs $(k get po | grep $1 | awk '{print $1; exit}' | tr -d \\n) | |
} | |
kx() { | |
k exec -it $(k get po | grep $1 | awk '{print $1; exit}' | tr -d \\n) -- $2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment