operating k8s – misc notes

basics

    #kubectl config get-clusters
    kubectx

    #kubectl get ns
    #--context <cluster>
    kubens -c

custom output for parsing

-o json
-o yaml

get into a specific container

e.g. when the sidecar is in your way…

kubectl get pods 
kubectl get pod POD_NAME_HERE -o jsonpath='{.spec.containers[*].name}'; echo

gives e.g.

exporter haproxy

so let’s get into the haproxy container

kubectl exec -ti POD_NAME_HERE -c haproxy -- /bin/bash

resources

https://stackoverflow.com/questions/37464518/how-to-format-the-output-of-kubectl-describe-to-json

HOME | GUIDES | PLAYBOOKS | LECTURES | LAB | CONTACT | HTML | CSS
Licensed as MIT