Whether `kubectl create deployment` will create a yaml config file?

I use kubectl created a deployment:

kubectl create deployment nginx-depl --image=nginx

I want to know whether this command will create a yaml config file? if is, where is the location?

No, it “creates” on the API server. You can use kubectl get -o yaml to fetch it.

1 Like

You can also use the --dry-run=client flag to produce the yaml locally.

 kubectl create deploy nginx --image nginx --dry-run=client -o yaml > test.yaml