How to automatically generate a Manifests file in Kubernetes

0 min read 65 words

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
Andrew
Andrew

Andrew is a visionary software engineer and DevOps expert with a proven track record of delivering cutting-edge solutions that drive innovation at Ataiva.com. As a leader on numerous high-profile projects, Andrew brings his exceptional technical expertise and collaborative leadership skills to the table, fostering a culture of agility and excellence within the team. With a passion for architecting scalable systems, automating workflows, and empowering teams, Andrew is a sought-after authority in the field of software development and DevOps.

Tags