Now delete the existing deployment using a command kubectl delete deployment nginx.

Create a new deployment from file we just modified using kubectl create -f first.yaml.

Get yaml of our new deployment and store it to file using a command kubectl get deployment nginx -o yaml > second.yaml.

Compare both files using diff first.yaml second.yaml. The time stamp, resource version and uid we had deleted are in the new file. These are generated for each resource we create, so we need to delete them
from yaml files to avoid conflicts or false information.

Get output in various format

Get output in various format and do a dry run

We can get YAML output and do dry run using a command kubectl create deployment two --image=nginx --dry-run -o yaml. he output lacks the unique information we removed before, but does have different output such as the apiVersion.

We can get output of existing deployment using a command kubectl get deployments nginx --export -o yaml. Same command can be used to get JSON output like kubectl get deployments nginx --export -o json.