logo
painting

Kubernetes Tips and Tricks

A few tips and tricks I’ve come across. Starting off small!

Export Cluster Config from Kubeconfig

Say you have a whole bunch of clusters set in your kubeconfig file and you want to extract one. Just one.

Set your config to that cluster (maybe use kubectx) and do:

kubectl config view --minify --raw > cluster.kubeconfig

Boom!

Writing an Operator in Shell!

See the shell operator. Good times!

Troubleshoot DNS

See this k8s doc

kubectl apply -f https://k8s.io/examples/admin/dns/dnsutils.yaml

Make sure you are in the default namespace.

Run a dig command from the pod.

$ kubectl exec -i -t dnsutils -- dig +short google.com
172.217.165.14