Word on the Cloud: Keeping you up-to-date on cloud native. Short & sharp!

kubectl tips: part 1

The kids go to bed and read things like Harry Potter and Charlie and the Chocolate Factory. As for me…. I go to bed and read Kubernetes YAML files and kubectl output with –v flag cranked up to the max 😀

kubectl verbosity

Last week, I learned that kubectl has a verbosity flag. Who knew!

To be honest, I’m shocked that I didn’t already know this. But I’m already over the shock, and I love it!

Basically, you slap -v or –v to the end of a kubectl command and give it an integer between 0-10. 1 is for wimps like me, and 10 is for people I wish I was like 😉

Here’s an example using level 7 verbosity to include requested resources and HTTP request headers.

Apologies for the use of an image instead of text, but GoDaddy is nothing short of terrible when it comes to blog software.

Anyway… thanks to my buddies at MSB for pointing me to the kubectl cheat sheet where the levels are documented . Shame on me for not reading the cheat sheet and not already knowing this!

On thing I will say, is that there is also a level 10 output that’s not documented on the cheat sheet.

kubectl explain

A related tip came courtesy of Duffie. Duffie’s a presenter on TGI Kubernetes and all-round K8s legend. 

I actually knew this one but had archived it to cold storage somewhere at the back of my brain. Anyway… kubectl explain with the –recursive flag will list all the properties you can set for an object, as well as data type of each property. Here’s an example for a StorageClass object. Notice how it also returns the API group and version for the object on your cluster.

You can also use kubectl explain to drill into a particular object property. This example drills into the spec.replicas property of a Deployment object. Obviously the descriptions are succinct, but sometimes you also get a link to the official docs.

Hope you find these tips useful!

Feel free to check out my books and video courses, as well as my YouTube channel and Kubernetes audio book.

Share this post



Special Editions

Word on the cloud: What's going on in cloud native

Nigel’s Keeping you up-to-date on cloud native. Short & sharp! #Docker #Kubernetes #WebAssembly #Wasm

© 2023 Nigel Poulton – All rights reserved


Looking for something specific?

Try the search facility.