Go Templates With Kubectl

An alternative to using jsonpath with kubectl is go templates!

Try switching this:

`shell kubectl get serviceaccount myserviceaccount --context supercoolcontext --namespace themagicalcloud -o jsonpath='{.secrets[0].name}'

To this and it should work just the same. Since I know go templates pretty well, this is a good alternative for jsonpath syntax.

`shell kubectl get serviceaccount myserviceaccount --context supercoolcontext --namespace themagicalcloud -o go-template='{{range .secrets }}{{.name}}{{end}}'

Further reading: