Skip to content

Instantly share code, notes, and snippets.

@vsliouniaev
Last active May 31, 2019 22:59
Show Gist options
  • Save vsliouniaev/20a917e329b749ae8b29d3056ab6243b to your computer and use it in GitHub Desktop.
Save vsliouniaev/20a917e329b749ae8b29d3056ab6243b to your computer and use it in GitHub Desktop.
# GPG - this allows signing of git commits
export GPG_TTY=$(tty)
#GO
export GOROOT=/usr/local/go
export GOPATH=/c/dev/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
# git commands
gl() { git log --pretty --oneline "$@"; }
gs() { git status -s; }
# Kubernetes
export HELM_HOME=/mnt/c/dev/helm
export DOCKER_HOST=tcp://0.0.0.0:2375
k() { kubectl "$@"; }
kg() { kubectl get "$@"; }
kd() { kubectl describe "$@"; }
ka() { kubectl apply "$@"; }
kc() { kubectl config current-context; }
kns() { kubectl config set-context $(kubectl config current-context) --namespace="$@"; }
kcontext() { if [ $# -eq 0 ]; then kubectl config current-context; echo "---"; kubectl config view | yq -r .contexts[].name; else kubectl config use-context $1; fi; }
prom-oplog() { kubectl logs $(kubectl get po --no-headers --namespace=monitoring -l operator=prometheus | awk '{print $1}') -f --namespace=monitoring --tail=20; }
helm-init-rbac() {
helm init;
kubectl create serviceaccount --namespace kube-system tiller;
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller;
kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}';
helm init --service-account tiller --upgrade;
}
new-kind() { kind delete cluster && kind create cluster && kcontext kubernetes-admin@kind && helm-init-rbac; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment