kubectl neat: clean exported YAML
Strip status, managedFields, cluster-assigned IPs and default values from kubectl get -o yaml, and get a manifest you can commit.
Runs locally. Nothing you paste leaves this tab.
What was removed
What gets removed
- Always:
status,uid,resourceVersion,generation,creationTimestamp,managedFields,ownerReferences, thelast-applied-configurationannotation, and labels the controllers add (pod-template-hash,controller-uid,job-name…). - Defaults: only when the value is exactly the default, such as
dnsPolicy: ClusterFirst,terminationGracePeriodSeconds: 30, a 25%/25% rolling update or probe timings of 1s/10s/1/3. A value you changed is kept. - Assigned values: a Service’s
clusterIPandnodePort, a pod’snodeNameand a PVC’svolumeName. Keep them only if you re-apply to the same cluster and need the same addresses.
Export the controller, not its pods: a Deployment, StatefulSet or Job manifest recreates the pods.
kubectl get deploy,svc,ingress,configmap -n prod -o yaml > live.yaml