9

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"
nikk
  • 2,627
  • 5
  • 30
  • 51
  • Does `minikube logs` show anything useful? – CJ Cullen Jul 12 '16 at 18:27
  • @CJCullen yes, I just updated question with error logs. – nikk Jul 12 '16 at 19:06
  • Hmmm. It looks like docker is having trouble reaching out to gcr.io. Are you able to manually `docker pull gcr.io/google_containers/pause-amd64:3.0`? Do you have any proxy settings that need to be configured? (like http://stackoverflow.com/questions/38301724/error-while-creating-pods-in-kubernetes/38312822?noredirect=1#comment64069942_38312822) – CJ Cullen Jul 12 '16 at 20:48
  • @CJCullen yes I am able to manually `docker pull gcr.io/google_containers/pause-amd64:3.0`. I do have proxy settings which I have configured on the bash prompt by `export http=xxx`, before running minikube and kubectl. Do I have to specify this setting in some configuration file for minikube? It looks. – nikk Jul 12 '16 at 22:20
  • Yeah, I'm guessing that the proxy config has to be provided to the docker daemon running in minikube's VM. I'm not sure how exactly to do that... – CJ Cullen Jul 13 '16 at 21:50
  • Something around `$(minikube docker-env)` maybe? – nikk Jul 13 '16 at 21:53
  • I filed an [Issue](https://github.com/kubernetes/minikube/issues/336) against minikube. Feel free to drop anything you've figured out there. – CJ Cullen Jul 13 '16 at 23:04
  • @CJCullen, thanks. I submitted an issue earlier here too. [Issue-322]https://github.com/kubernetes/minikube/issues/322 – nikk Jul 14 '16 at 10:23

3 Answers3

5

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)

mrc
  • 66
  • 1
  • 3
  • In case of Windows, it is `set NO_PROXY="127.0.0.1,[minikube_ip]"` – gdenuf Oct 04 '17 at 06:15
  • Above mentioned solution doesnt work for me. I'm using Windows 8.1 and started the minikube by passing the proxy details. Also I have set NO_PROXY with minikube ip. Still getting the error as `Unable to connect to the server: net/http: TLS handshake timeout` – user2439278 Jan 30 '18 at 16:42
1

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

daniu
  • 14,137
  • 4
  • 32
  • 53
  • This seems to be a github issue with an example of how to use the `--memory` flag. https://github.com/kubernetes/minikube/issues/567 However this did not work for me. JFYI. – rsmets Jan 11 '21 at 22:34
1

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

ToTenMilan
  • 582
  • 1
  • 9
  • 19