Created
October 6, 2019 22:43
-
-
Save omkar0001/3cec97d220a0f0b12b42db2efa37f864 to your computer and use it in GitHub Desktop.
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
# Kubernetes usefulness. | |
alias kubeprod='kubectl config use-context gke_typegenie_europe-west1-d_production' | |
alias kubestag='kubectl config use-context gke_typegenie_europe-west1-b_staging' | |
eval $(kubectl completion zsh) | |
alias kubectx="kubectl config current-context" | |
# Shells into a service on the current kubernetes cluster | |
function kubesh { | |
local service=${1:?"Service name must be arg1"} | |
kubectl exec -it $(kubectl get po | grep $service | awk '{ print $1 }') bash | |
} | |
function kubeforward { | |
local service=${1:?"Service name must be arg1"} | |
local port=${2:?"Port musst be arg2"} | |
kubectl port-forward $(kubectl get po | grep $service | awk '{ print $1 }') $port | |
} | |
function kubelog { | |
local service=${1:?"Service name must be arg1"} | |
shift | |
if [[ $1 == -f ]]; then | |
FOLLOW=-f | |
shift | |
fi | |
kubectl logs $FOLLOW $(kubectl get po | grep $service | awk '{ print $1 }') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment