you can just run with –dry-run=client option to generate yaml file. Which is then you can add any other elements or delete
![](https://www.alddit.com/wp-content/uploads/2023/04/image-12.png)
if you pass –env variables in the command even that also will added to the yaml file .
run –env env=prod nginx –image=nginx –dry-run=client -o yaml
root@master:/tmp# k run --env env=prod nginx --image=nginx --dry-run=client -o yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: nginx
name: nginx
spec:
containers:
- env:
- name: env
value: prod
image: nginx
name: nginx
resources: {}
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}
root@master:/tmp#