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 creationtimestamp, uid_selflink, etc.
for example, something like this would be perfect:
kubectl get daemonset mydaemonset --no-meta-data -o yaml > exported-mydaemonset.yamlI want to discard information about the current object state.
You could also do 
kubectl apply view-last-applied daemonset mydaemonset -o yaml which gives you the output in the format you require.
You can make use of the annotation field kubectl.kubernetes.io/last-applied-configuration, which holds the resource initial applied configuration without auto-generated fields.
Get it manually, or parse it with yq:
kubectl get daemonset mydaemonset -o yaml | \
yq r - 'metadata.annotations."kubectl.kubernetes.io/last-applied-configuration"'