How to generate kubernetes yaml file using template generator?

1/3/2019

I am kubernetes newbie, and I have a basic question

my understanding from https://kubernetes.io/docs/reference/kubectl/conventions/ is , we can generate yaml templates using "kubernetes run" command

But when I tried doing same, it didn't work attachment

Not sure if my understanding is wrong or something wrong in my command

-- Lav
kubectl
kubernetes

2 Answers

1/3/2019

You're just missing a few flags.

The command should be

kubectl run <podname> --image <imagename:tag> --dry-run -o yaml --generator=run-pod/v1 

for example:

kubectl run helloworld --image=helloworld --dry-run -o yaml --generator=run-pod/v1 
-- macintoshPrime
Source: StackOverflow

1/3/2019

You need to specify all the required flags, in this case --image=...

-- Jordan Liggitt
Source: StackOverflow