I am a newbie to Kubernetes and trying to install Kubernetes locally on my Mac machine.
I am following the below tutorial on Kubernetes website
https://minikube.sigs.k8s.io/docs/start/
Now, I am at a step where it tells to deploy simple application in my local cluster. I deployed it. Now when I try to access my service using the following command
minikube service hello-minikube
It launches the browser. Though the browser never shows the service and keeps hanging at 127.0.0.1.
Due to the above problem, I used to the following command
kubectl port-forward service/hello-minikube 7080:8080
When i try to launch my browser using http://localhost:7080/
I get error attached in the snapshot which is a connection refused issue.
Can someone guide me what's going wrong here?
Cheers,
After the below answer
I tried both of the commands, but the browser keeps revolving, but the service is never loaded. Here is a snapshot for you
to access your application either use minikube tunnel
and then access it by one of the endopoints of your servers IPs and and port.
Another option would be to expose your application via a service of type NodePort and then use minikube service $servicename
Edit:
just a quick sanity check, can you try running the following commands?
$ kubectl create deployment nginx --image nginx --port 80
$ kubectl expose deployment nginx --name nginx-svc --type NodePort
$ minikube service nginx-svc
--> this should open your browser with IP of minikube cluster using the services NodePort and you should see the nginx welcome page
The other way you should be able to access the service is, after creation of deployment and service:
$ minukube tunnel nginx-svc
$ kubectl port-forward $nginx-podname 8080:80
--> browsing to localhost:8080 should show nginx welcome page.
Please check if this is how your setup currently behaves. if it doesn't there's a problem in your setup that needs to be further explored. if it does, please share your yaml resources, so we might be able to find the problem