<p>I'm trying to get metadata for a given kubernetes resource. Similar to a <code>describe</code> for a REST end-point.</p>

<p>Is there a <code>kubectl</code> to get all possible things that I could provide for any k8s resource ?</p>

<p>For example for the deployment resource, it could be something like this.</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: &lt;type:String&gt; 
        &lt;desc: name for the deployment&gt;
  namespace: &lt;type:String&gt;
             &lt;desc: Valid namespace&gt;
  annotations:
    ...
</code></pre>

<p>Thanks in advance !</p>

<p>You can use the <code>kubectl explain</code> CLI command:</p>

<blockquote>
  <p>This command describes the fields associated with each supported API
  resource. Fields are identified via a simple JSONPath identifier:</p>
  
  <p><code>&lt;type&gt;.&lt;fieldName&gt;[.&lt;fieldName&gt;]</code></p>
  
  <p>Add the <code>--recursive</code> flag to display all of the fields at once without descriptions. Information about each field is retrieved from the server in OpenAPI format.</p>
</blockquote>

<p>Example to view all <em>Deployment</em> associated fields:</p>

<p><code>kubectl explain deployment --recursive</code></p>

<p>You can dig into specific fields:</p>

<p><code>kubectl explain deployment.spec.template</code></p>

<p>You can also rely on <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.16/#deployment-v1-apps" rel="nofollow noreferrer">Kubernetes API Reference Docs</a>.</p>
