<p>I'm trying to export a daemonset from my kubernetes cluster but I dont want any of the metadata. Is there a way I can export the manifest file without the metadata, like <code>creationtimestamp</code>, <code>uid_selflink</code>, etc.</p>
<p>for example, something like this would be perfect:</p>
<pre><code>kubectl get daemonset mydaemonset --no-meta-data -o yaml &gt; exported-mydaemonset.yaml
</code></pre>
<p>I want to discard information about the current object state.</p>

Chesneycar
<p>You can make use of the annotation field <code>kubectl.kubernetes.io/last-applied-configuration</code>, which holds the resource initial applied configuration without auto-generated fields.</p>
<p>Get it manually, or parse it with <a href="https://github.com/mikefarah/yq" rel="nofollow noreferrer">yq</a>:</p>
<pre><code>kubectl get daemonset mydaemonset -o yaml | \
yq r - 'metadata.annotations.&quot;kubectl.kubernetes.io/last-applied-configuration&quot;'
</code></pre>
