Unknown tag generator

Hi,

When I try this command in Google kubernetes:

kubectl run --generator=run-pod/v1 --image=nginx:alpine myfirstpod -- labels=example=myfirstpod

I got the following error:

Error: unknown flag: --generator

I’m not sure why but --generator tag is definitely in the Kubernetes documentation! Can anyone explain this error?

Many thanks

Hello, @minh_duc
What is your k8s cluster version?

Before k8s v1.18, we use this to create a pod. Now k8s version v1.18+, we don’t need to use this anymore to create a pod.
Simply run the below command to create a pod:

kubectl run --image=nginx:alpine myfirstpod -- labels=example=myfirstpod

Reference:-
https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#run

1 Like