Minikube node is NOT reachable[This site can’t be reached]

While using service type nodePort in minikube, you may notice issues that minikube IP can’t be reachable in the browser.

192.x.x.x This site can’t be reached

To avoid the issues when you test Kubernetes in your local using minikube. Follow the below instructions.

Your minikube local setup must be running with the docker driver, which is a show stopper here. Here is the fix.

  • Stop minikube
minikube stop
  • Delete minikube
minikube delete
  • Start minikube with hyperkit
minikube start --vm-driver=hyperkit
  • Now you can deploy your nodePort service to your minikube cluster.

Deployment YAML: hello-deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
name: helloweb
labels:
app: hello
spec:
replicas: 3
selector:
matchLabels:
app: hello
tier: web
template:
metadata:
labels:
app: hello
tier: web
spec:
containers:
- name: hello-app
image: us-docker.pkg.dev/google-samples/containers/gke/hello-app:1.0
ports:
- containerPort: 8080
resources:
requests:
cpu: 200m

Service YAML: nodePort-service.yaml

apiVersion: v1
kind: Service
metadata:
name: nodeport-service
spec:
type: NodePort
selector:
app: hello
ports:
# By default and for convenience, the `targetPort` is set to the same value as the `port` field.
- port: 8080
# targetPort: 8080
# Optional field
# By default and for convenience, the Kubernetes control plane will allocate a port from a range (default: 30000-32767)
nodePort: 31000
  • Apply the above YAML’s in your minikube cluster.
kubectl apply -f hello-deployment.yaml
kubectl apply -f nodePort-service.yaml
  • Now you can access the minikube IP in the web browser or from the command line.
curl $(minikube ip):31000(or)
https://<MINIKUBE IP>:31000

Thanks for reading..!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store