kubectl supports --server-dry-run
so that modifications are not persisted but changes from admission controllers etc. are applied. The default output looks something like the following:
$ kubectl apply --server-dry-run -f deployment.yaml
deployment.apps/nginx-deployment created (server dry run)
However, adding -v=8
shows me the response body with the actual JSON content that will be persisted to etcd. Is there any way to ask kubectl to print that in a nicer format without some crazy grepping etc.?
You can also use kubectl diff -f deployment.yaml
to see what changed.
You can get the appropriate Json by using following command:
kubectl apply --server-dry-run - f deployment.yaml -o json