Can not connect to service in 192.168.99.101

1/7/2019

I am new on kubernetes and need your help. I followed installation instruction on this page and everything worked fine. Here are some Info after installation:

~ > kubectl version
Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.1", GitCommit:"eec55b9ba98609a46fee712359c7b5b365bdd920", GitTreeState:"clean", BuildDate:"2018-12-13T19:44:10Z", GoVersion:"go1.11.2", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.4", GitCommit:"f49fa022dbe63faafd0da106ef7e05a29721d3f1", GitTreeState:"clean", BuildDate:"2018-12-14T06:59:37Z", GoVersion:"go1.10.4", Compiler:"gc", Platform:"linux/amd64"}

~ > kubectl cluster-info
Kubernetes master is running at https://192.168.99.101:8443

~ > minikube ip
192.168.99.101

Then I try to run a simple hello world service:

~ > minikube start
~ > kubectl get nodes
NAME       STATUS   ROLES    AGE   VERSION
minikube   Ready    <none>   18h   v1.12.4

~ > kubectl run hw --image=karthequian/helloworld --port=80
kubectl run --generator=deployment/apps.v1 is DEPRECATED and will be removed in a future version. Use kubectl run --generator=run-pod/v1 or kubectl create instead.
deployment.apps/hw created

~ > kubectl get deployments
NAME   DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
hw     1         1         1            1           21s

~ > kubectl get rs
NAME           DESIRED   CURRENT   READY   AGE
hw-854c64787   1         1         1       71s

~ > kubectl get pods
NAME                 READY   STATUS    RESTARTS   AGE
hw-854c64787-8xhw6   1/1     Running   0          59s

~ > kubectl expose deployment hw --type=NodePort
service/hw exposed

~> kubectl get services
NAME         TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)        AGE
hw           NodePort    10.106.4.194   <none>        80:31269/TCP   6m23s
kubernetes   ClusterIP   10.96.0.1      <none>        443/TCP        20h 

~ > minikube service hw
Opening kubernetes service default/hw in default browser...

After the last line I got this output: enter image description here

Did I do something wrong? Is there anything I have not configured right? Thank you.

-- MediocreThingy
kubernetes

1 Answer

1/8/2019

Here is how I solved this problem. First I go to Docker -> Preferences -> Kubernetes and Tick "Enable Kubernetes". It will take around 5 mins to install.

enter image description here

Then I delete my current minikube with minikube delete and repeat the whole process(minikube start, kubectl run hw --image=karthequian/helloworld --port=80, kubectl expose deployment hw --type=NodePort, minikube service hw ) and it works :).

-- MediocreThingy
Source: StackOverflow