My Favourite Kubernetes Aliases

by chrles
kubernetesdevopsalias

Kubernetes Alias

Some of my favourite shortcuts for infrastructure tooling

Change Namespace

alias nset="kubectl config set-context --current --namespace"

To use just do

nset myapp

Restart Deployment

alias bounce="kubectl rollout restart deployment"

Restart a deployment example

bounce myapp

# or

bounce myapp -n myapp

Debug Pod

alias debug_pod="kubectl run debug-alpine \
    --image=alpine:latest \
    --restart=Never \
    --command -- sleep infinity && sleep 10 && kubectl exec -it debug-alpine -- sh"

In ~10 sec you should get inside your cluster with in your fresh alpine pod.

Don't forget to remove the pod

kubectl delete pods/debug-alpine  

Alias

Some alias I like to create:

alias hf="helmfile"
alias tf="terraform"
alias talo="talosctl"

Home