If you want to automatically generate a manifest file in Kubernetes, you can do so by using the kubectl run command coupled with a --dry-run to output directly to yaml.

kubectl run nginx --image=nginx --port=80 --replicas=2 --expose --dry-run -o yaml

You can also output this directly to a file on disk as follows:

kubectl run nginx --image=nginx --port=80 --replicas=2 --expose --dry-run -o yaml > your-deployment-manifest.yaml