In a kubernetes cluster we can create a workload and expose it in two separate commands.
Could we do it in one command?
This could be achieved by the below command. It will create a workload and also expose it in same time.
kubectl run nginx-digital --image=nginx --expose=true --port=80
The above command will create a deployment nginx-digital and also expose it with ClusterIP service with name nginx-digital at port 80.