Minikube : remote error tls: bad certificate
Asked Answered
S

1

7

I'm following a Kubernetes tutorial, and cannot run first command (minikube start --vm-driver=hyperkit). I'm using a MacBook Pro Intel on macOs Monterey. I cannot make it work because of TLS error.

$ minikube start --vm-driver=hyperkit
πŸ˜„  minikube v1.25.2 on Darwin 12.2.1
πŸ†•  Kubernetes 1.23.3 is now available. If you would like to upgrade, specify: --kubernetes-version=v1.23.3
✨  Using the hyperkit driver based on existing profile
πŸ‘  Starting control plane node minikube in cluster minikube
πŸ”„  Restarting existing hyperkit VM for "minikube" ...
🐳  Preparing Kubernetes v1.20.2 on Docker 20.10.3 ...
❌  Problems detected in etcd [592b8a58065e]:
    2022-03-19 22:12:03.193985 I | embed: rejected connection from "127.0.0.1:38132" (error "remote error: tls: bad certificate", ServerName "")

I tried :

  1. Restarted the computer : https://github.com/kubernetes/minikube/issues/4329
  2. Used --embed-certs argument
$ minikube start --vm-driver=hyperkit --embed-certs
πŸ˜„  minikube v1.25.2 on Darwin 12.2.1
πŸ†•  Kubernetes 1.23.3 is now available. If you would like to upgrade, specify: --kubernetes-version=v1.23.3
✨  Using the hyperkit driver based on existing profile
πŸ‘  Starting control plane node minikube in cluster minikube
πŸ”„  Restarting existing hyperkit VM for "minikube" ...
🐳  Preparing Kubernetes v1.20.2 on Docker 20.10.3 ...
❌  Problems detected in etcd [78d1e36569b8]:
    2022-03-19 22:20:53.503532 I | embed: rejected connection from "127.0.0.1:34926" (error "remote error: tls: bad certificate", ServerName "")

I'm new to K8s, what could cause such behaviour ?


I installed minikube and hyperkit with homebrew. When I display the kubectl version I get another connection error :

kubectl version
Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.5", GitCommit:"5c99e2ac2ff9a3c549d9ca665e7bc05a3e18f07e", GitTreeState:"clean", BuildDate:"2021-12-16T08:38:33Z", GoVersion:"go1.16.12", Compiler:"gc", Platform:"darwin/amd64"}
Unable to connect to the server: dial tcp 192.168.64.2:8443: i/o timeout
Syllabize answered 19/3, 2022 at 22:30 Comment(0)
S
11

The kubectl version error helped : Unable to connect to the server: dial tcp i/o time out

It seems I had already played with k8s :

$ kubectl config view
apiVersion: v1
clusters:
- cluster:
    certificate-authority: /Users/xxx/.minikube/ca.crt
    extensions:
    - extension:
        last-update: Sat, 13 Mar 2021 13:40:06 CET
        provider: minikube.sigs.k8s.io
        version: v1.18.1
      name: cluster_info
    server: https://192.168.64.2:8443
  name: minikube
contexts:
- context:
    cluster: minikube
    extensions:
    - extension:
        last-update: Sat, 13 Mar 2021 13:40:06 CET
        provider: minikube.sigs.k8s.io
        version: v1.18.1
      name: context_info
    namespace: default
    user: minikube
  name: minikube
current-context: minikube
kind: Config
preferences: {}
users:
- name: minikube
  user:
    client-certificate: /Users/xxx/.minikube/profiles/minikube/client.crt
    client-key: /Users/xxx/.minikube/profiles/minikube/client.key

First I deleted the existing cluster :

$ kubectl config delete-cluster minikube
deleted cluster minikube from /Users/xxx/.kube/config

Then run

$ minikube delete
πŸ”₯  Deleting "minikube" in hyperkit ...
πŸ’€  Removed all traces of the "minikube" cluster.

Finally :

$ minikube start --vm-driver=hyperkit
πŸ˜„  minikube v1.25.2 on Darwin 12.2.1
✨  Using the hyperkit driver based on user configuration
πŸ‘  Starting control plane node minikube in cluster minikube
πŸ’Ύ  Downloading Kubernetes v1.23.3 preload ...
    > preloaded-images-k8s-v17-v1...: 505.68 MiB / 505.68 MiB  100.00% 923.34 K
πŸ”₯  Creating hyperkit VM (CPUs=2, Memory=4000MB, Disk=20000MB) ...
🐳  Preparing Kubernetes v1.23.3 on Docker 20.10.12 ...
    β–ͺ kubelet.housekeeping-interval=5m
    β–ͺ Generating certificates and keys ...
    β–ͺ Booting up control plane ...
    β–ͺ Configuring RBAC rules ...
πŸ”Ž  Verifying Kubernetes components...
    β–ͺ Using image gcr.io/k8s-minikube/storage-provisioner:v5
🌟  Enabled addons: default-storageclass, storage-provisioner
πŸ„  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
Syllabize answered 20/3, 2022 at 10:2 Comment(0)

© 2022 - 2024 β€” McMap. All rights reserved.