While solving lab exercise I have observed where I am creating service using imp . . .

Ravi Shanker:
While solving lab exercise I have observed where I am creating service using imperative command the solution shows expose deployment command. Also the labels are to be worked on while creating service and nodeport, namespace for expose deployment. If someone can share more light on the approaches.

Mayur Sharma:
@Ravi Shanker when you use kubectl expose deployment/pod, it automatically select the required selector of deployment/pod.

You can verify the labels by creating the yaml file out of kubectl expose command.

There is no way to add nodeport in above command, you have to edit the yaml file post dry-run and add the nodeport

Shwetha Shenoy V:
I would suggest using --help with your command to explore the options available. Experience makes it easy to remember the commands along with options it presents. Do remember the solutions may be created on an older version of k8s and the new k8s version has more command options.