Autonatic creation of selectors using "imperative" commands

Hi, I’ve executed this command on my terminal
“kubectl expose pod redis --port=6379 --name=redis-service --dry-run=client -o yaml”

and it created the pod redis.

But how it created the selector
named
“tier:db”?

I haven’t specified anywhere in this command.

Please check the below scr

eenshot

Hello, @Ashu27
By default, in the expose command. It takes from the pod specs.

Thanks for the help @Tej-Singh-Rana. And what if I need custom labels?

I think it’s a custom labels which you defined in the pod creation time?

Oh damn! @Tej-Singh-Rana I am turning towards the road of confusion :neutral_face:

It will not. In the only beginning level, you will face difficulties after that you will deploy Pod and use custom labels like a Pro. :grin: