Skip to main content
arunbsar

1 year ago

Why can't we use --export option

Hi Chad,

In lecture "Deployments, Rolling Updates, and Rollbacks" you have mentioned the command "kubectl get deployment nginx-deployment -o yaml" to export yaml to a file and delete the status why can't we use --export flag with the above command to get clean yaml

Image of w.alexanderuc-ea2ddce5
w.alexanderuc-ea2ddce5
1 year ago

Hi Arun,

That's why when running that command, you are making a request to the API Server. When you create an object, Kubernetes tries to create the desired object based upon the spec file (yaml)... thus when working with -o yaml besides getting your spec you also get the status of that spec. 

You could also try with --export at the end of the command to get less information about the status but bear in mind you need to delete some lines before use the exported yaml.


Wish you a good learning time!