Hi All, How can we specify `nodeport` in `kubectl expose` command I am not able . . .

Hi All,
How can we specify nodeport in kubectl expose command
I am not able to find a suitable flag for it
Thank you

Fábio Vieira:
Hi, try use --type=NodePort in your command

Apaar Sharma:
you can define the type nodeport but not the actual node port imperatively in my experience, do a dry run and specify the nodePort in the yaml file.

Leonardo Cordeiro:
you cannot specify nodeport on expose command. Try use kubectl create service nodeport

Fábio Vieira:
Good to know this @Apaar Sharma … thanks… :slightly_smiling_face:

Thanks guys, undertood

Yannam C Chiranjeevi:
@Leonardo Cordeiro kubectl is agnostic of the object we are exposing. Where as kubectl automatically creates selectors for the labels in the target object.