Exposing the hello-minikube service fails to find a port
You get this error because you didn't set the container port from the command kubectl run hello-minikube --image=gcr.io/google_containers/echoserver:1.4 --port=
as such the expose command doesn't know which container port to map to a node port and then error
You have to set exact container port as follow kubectl run hello-minikube --image=gcr.io/google_containers/echoserver:1.4 --port=80
assuming 80
is the port number and then run the expose again.
See bellow step by step of how I was able to replicate your error and then fix
C:\Users\innocent.anigbo\.minikube>kubectl run hello-kube --image=gcr.io/google_containers/echoserver:1.4 --port=deployment "hello-kube" createdC:\Users\innocent.anigbo\.minikube>kubectl get podsNAME READY STATUS RESTARTS AGEhello-kube-1448409582-c9sm5 1/1 Running 0 1mhello-minikube-938614450-417hj 1/1 Running 1 8dhello-nginx-3322088713-c4rp4 1/1 Running 0 6mC:\Users\innocent.anigbo\.minikube>kubectl get deploymentNAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGEhello-kube 1 1 1 1 2mhello-minikube 1 1 1 1 8dhello-nginx 1 1 1 1 7mC:\Users\innocent.anigbo\.minikube>kubectl get serviceNAME CLUSTER-IP EXTERNAL-IP PORT(S) AGEhello-nginx 10.0.0.136 <nodes> 80:32155/TCP 4mkubernetes 10.0.0.1 <none> 443/TCP 20dC:\Users\innocent.anigbo\.minikube>kubectl expose deployment hello-kube --type=NodePorterror: couldn't find port via --port flag or introspectionSee 'kubectl expose -h' for help and examples.C:\Users\innocent.anigbo\.minikube>kubectl delete deployment hello-kubedeployment "hello-kube" deletedC:\Users\innocent.anigbo\.minikube>kubectl get podsNAME READY STATUS RESTARTS AGEhello-minikube-938614450-417hj 1/1 Running 1 8dhello-nginx-3322088713-c4rp4 1/1 Running 0 11mC:\Users\innocent.anigbo\.minikube>kubectl run hello-kube --image=gcr.io/google_containers/echoserver:1.4 --port=80deployment "hello-kube" createdC:\Users\innocent.anigbo\.minikube>kubectl get podsNAME READY STATUS RESTARTS AGEhello-kube-2715294448-0rxf2 1/1 Running 0 3shello-minikube-938614450-417hj 1/1 Running 1 8dhello-nginx-3322088713-c4rp4 1/1 Running 0 11mC:\Users\innocent.anigbo\.minikube>kubectl expose deployment hello-kube --type=NodePortservice "hello-kube" exposedC:\Users\innocent.anigbo\.minikube>kubectl get serviceNAME CLUSTER-IP EXTERNAL-IP PORT(S) AGEhello-kube 10.0.0.137 <nodes> 80:30004/TCP 3shello-nginx 10.0.0.136 <nodes> 80:32155/TCP 9mkubernetes 10.0.0.1 <none> 443/TCP 20d
Your pod is reappearing because deployment creates a replica set for the container which creates a new one if the current pod terminates.
Run this to check if there is a replica set deployed.
kubectl get rs
You should ideally delete the entire deployment
kubectl delete deployment <name>