Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubectl: Kubernetes with minikube times out

I have installed minikube and started up its built in Kubernertes cluster

$ minikube start
Starting local Kubernetes cluster...
Kubernetes is available at https://192.168.99.100:443.
Kubectl is now configured to use the cluster.

I also have kubectl installed

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"3", GitVersion:"v1.3.0", GitCommit:"283137936a498aed572ee22af6774b6fb6e9fd94", GitTreeState:"clean", BuildDate:"2016-07-01T19:26:38Z", GoVersion:"go1.6.2", Compiler:"gc", Platform:"linux/amd64"}

But I can't successfully use kubectl to speak to the running Kubernetes cluster

$ kubectl get nodes
Unable to connect to the server: net/http: TLS handshake timeout

EDIT

$ minikube logs 

E0712 19:02:08.767815    1257 docker_manager.go:1955] Failed to create pod infra container: ImagePullBackOff; Skipping pod "kube-addon-manager-minikubevm_kube-system(48abed82af93bb0b941173334110923f)": Back-off pulling image "gcr.io/google_containers/pause-amd64:3.0"
E0712 19:02:08.767875    1257 pod_workers.go:183] Error syncing pod 48abed82af93bb0b941173334110923f, skipping: failed to "StartContainer" for "POD" with ImagePullBackOff: "Back-off pulling image \"gcr.io/google_containers/pause-amd64:3.0\""
E0712 19:02:23.767380    1257 docker_manager.go:1955] Failed to create pod infra container: ImagePullBackOff; Skipping pod "kube-addon-manager-minikubevm_kube-system(48abed82af93bb0b941173334110923f)": Back-off pulling image "gcr.io/google_containers/pause-amd64:3.0"
E0712 19:02:23.767464    1257 pod_workers.go:183] Error syncing pod 48abed82af93bb0b941173334110923f, skipping: failed to "StartContainer" for "POD" with ImagePullBackOff: "Back-off pulling image \"gcr.io/google_containers/pause-amd64:3.0\""
E0712 19:02:36.766696    1257 docker_manager.go:1955] Failed to create pod infra container: ImagePullBackOff; Skipping pod "kube-addon-manager-minikubevm_kube-system(48abed82af93bb0b941173334110923f)": Back-off pulling image "gcr.io/google_containers/pause-amd64:3.0"
E0712 19:02:36.766760    1257 pod_workers.go:183] Error syncing pod 48abed82af93bb0b941173334110923f, skipping: failed to "StartContainer" for "POD" with ImagePullBackOff: "Back-off pulling image \"gcr.io/google_containers/pause-amd64:3.0\""
E0712 19:02:51.767621    1257 docker_manager.go:1955] Failed to create pod infra container: ImagePullBackOff; Skipping pod "kube-addon-manager-minikubevm_kube-system(48abed82af93bb0b941173334110923f)": Back-off pulling image "gcr.io/google_containers/pause-amd64:3.0"
E0712 19:02:51.767672    1257 pod_workers.go:183] Error syncing pod 48abed82af93bb0b941173334110923f, skipping: failed to "StartContainer" for "POD" with ImagePullBackOff: "Back-off pulling image \"gcr.io/google_containers/pause-amd64:3.0\""
E0712 19:03:02.766548    1257 docker_manager.go:1955] Failed to create pod infra container: ImagePullBackOff; Skipping pod "kube-addon-manager-minikubevm_kube-system(48abed82af93bb0b941173334110923f)": Back-off pulling image "gcr.io/google_containers/pause-amd64:3.0"
E0712 19:03:02.766609    1257 pod_workers.go:183] Error syncing pod 48abed82af93bb0b941173334110923f, skipping: failed to "StartContainer" for "POD" with ImagePullBackOff: "Back-off pulling image \"gcr.io/google_containers/pause-amd64:3.0\""
E0712 19:03:16.766831    1257 docker_manager.go:1955] Failed to create pod infra container: ImagePullBackOff; Skipping pod "kube-addon-manager-minikubevm_kube-system(48abed82af93bb0b941173334110923f)": Back-off pulling image "gcr.io/google_containers/pause-amd64:3.0"
E0712 19:03:16.766904    1257 pod_workers.go:183] Error syncing pod 48abed82af93bb0b941173334110923f, skipping: failed to "StartContainer" for "POD" with ImagePullBackOff: "Back-off pulling image \"gcr.io/google_containers/pause-amd64:3.0\""
E0712 19:04:15.829223    1257 docker_manager.go:1955] Failed to create pod infra container: ErrImagePull; Skipping pod "kube-addon-manager-minikubevm_kube-system(48abed82af93bb0b941173334110923f)": image pull failed for gcr.io/google_containers/pause-amd64:3.0, this may be because there are no credentials on this request.  details: (Error response from daemon: Get https://gcr.io/v1/_ping: dial tcp 74.125.28.82:443: i/o timeout)
E0712 19:04:15.829326    1257 pod_workers.go:183] Error syncing pod 48abed82af93bb0b941173334110923f, skipping: failed to "StartContainer" for "POD" with ErrImagePull: "image pull failed for gcr.io/google_containers/pause-amd64:3.0, this may be because there are no credentials on this request.  details: (Error response from daemon: Get https://gcr.io/v1/_ping: dial tcp 74.125.28.82:443: i/o timeout)"
E0712 19:04:31.767536    1257 docker_manager.go:1955] Failed to create pod infra container: ImagePullBackOff; Skipping pod "kube-addon-manager-minikubevm_kube-system(48abed82af93bb0b941173334110923f)": Back-off pulling image "gcr.io/google_containers/pause-amd64:3.0"
like image 581
nikk Avatar asked Jul 12 '16 15:07

nikk


3 Answers

To get it running behind the a proxy you need to setup things a bit differently from the documentation. a. You need to ensure that the docker daemon running with the VM can reach out to the internet via the proxy. b. You need to ensure kubectl running on the host can get to the VM without going out through the proxy

Using the default kubectl example

  1. Ensure that the proxy is passed into the VM that is created by minikube (this ensures that the docker daemon within the VM can get out to the internet)

minikube start --vm-driver="kvm" --docker-env="http_proxy=xxx" --docker-env="https_proxy=yyy" start

Note: Replace xxx and yyy with your proxy settings

  1. Get the IP that the VM gets at startup.

minikube ip

Note: You need to do this each time you setup minikube as it can change

  1. Ensure that kubectl can talk to this VM without going to the proxy

export no_proxy="127.0.0.1,[minikube_ip]"

  1. Now kick off the POD and test it

kubectl run hello-minikube --image=gcr.io/google_containers/echoserver:1.4 --port=8080

kubectl expose deployment hello-minikube --type=NodePort

kubectl get pod

curl $(minikube service hello-minikube --url)

like image 142
mrc Avatar answered Nov 06 '22 21:11

mrc


Although, it is an old issue, but answering here so that it could help other facing this issue.

I was getting below error, because minikube VM was short of memory that was allocated.Increasing RAM should solve this issue.

Unable to connect to the server: net/http: TLS handshake timeout

The minikube VM is configured by default to only use 2gb of memory. You can change this value during minikube start with the --memory flag. Minikube would be needed to stop, delete and start again

like image 24
Naveen Katiyar Avatar answered Nov 06 '22 19:11

Naveen Katiyar


Behind corporate proxy, set environment variables like this:

export HTTP_PROXY=http://<proxy hostname:port>
export HTTPS_PROXY=https://<proxy hostname:port>
export NO_PROXY=localhost,127.0.0.1,10.96.0.0/12,192.168.99.0/24,192.168.39.0/24

and then:

minikube start

more info here

like image 1
ToTenMilan Avatar answered Nov 06 '22 21:11

ToTenMilan