aliases snippets

Bash aliases / functions for kubectl

Tagged aliases, kubectl, k8s  Languages bash

Put the following functions in, for example, ~/.bash_aliases:

function kshell() { kubectl exec -it "$1" -- /bin/bash ;}
function kpods() { kubectl get po -n default -o wide ;}
function klogs() { kubectl logs --tail=100 -f "$1" ;}
function krestart() { kubectl rollout restart "deploy/$1" ;}
function kdesc() { kubectl describe pod $1;}
function ksecret() { kubectl get secret $1 -o jsonpath="{.data.$2}" | base64 --decode ;}

Your RSI and symptoms of cognitive dissonance will disappear in about 6 months.