k8s 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.

How to solve "CreateContainerConfigError" in Kubernetes

Tagged createcontainerconfigerror, k8s, kubectl  Languages bash

To solve CreateContainerConfigError you can try this command:

$ kubectl describe pod xxx-86cbd7555b-2zrs2
  Warning  Failed     75s (x8 over 2m50s)  kubelet, k8s-node1  Error: couldn't find key XXX in ConfigMap default/xxx