Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate kubernetes yaml file using template generator?

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

like image 872
Lav Avatar asked Jan 01 '23 11:01

Lav


1 Answers

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 
like image 146
macintoshPrime Avatar answered Jan 04 '23 02:01

macintoshPrime