Ever wanted to know a field in your Kubernetes yaml definition, but found it ridiculously difficult to find out what it means or even how to use it š„?
kubectl
is to the rescue!
To get started we can familiarise ourselves with what API resources we have available to use. To do this we can run kubectl api-resources
, looking at the output of this command we can start to paint a picture of what resources our cluster is composed of.
Letās take the deployment resource as our first example. Interestingly we can see that multiple definitions exist for this resource, once for the API Group extensions
and one for apps
. We will find out why this is the case later on š¤Æ!
So how do we write a yaml definition for this deployment? Itās possible to get examples for the Kubernetes documentation ā personally I always find this too difficult to navigate, instead, it is possible to interrogate the API serverās OpenAPI specification using kubectl.
The command in question is kubectl explain
, so letās give this a whirl š!
This will show us all of the keys that are available to use at the top level.
If you really want to dive deep you can add a ārecursiveā parameter!
But I will omit the output so you can check it out yourself! (Hint: the output is longer than this post š)