<p>I installed minikube on my windows laptop and everything was fine, but when I tried to run <code>kubectl get pod</code> or any other kubectl commands I am getting this message:</p>

<pre><code>kubectl get pod
error: You must be logged in to the server (Unauthorized)
</code></pre>

<p>I do not know what am I doing wrong even though I added the credentials to my configuration:</p>

<pre><code>apiVersion: v1
clusters:
- cluster:
    certificate-authority: C:\Users\robert\.minikube\ca.crt
    server: https://192.168.99.100:8443
  name: minikube
contexts:
- context:
    cluster: minikube
    user: minikube
  name: minikube
current-context: minikube
kind: Config
preferences: {}
users:
- name: minikube
  user:
    as-user-extra: {}
    client-certificate: C:\Users\robert\.minikube\client.crt
    client-key: C:\Users\robert\.minikube\client.key
</code></pre>

<h2>minikube info</h2>

<pre><code>minikube version
minikube version: v0.25.1
</code></pre>

<h2>minikube upgrade</h2>

<pre><code>minikube version: v0.25.2
</code></pre>

<h2>Kubernetes info</h2>

<pre><code>kubectl version
Client Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.6", GitCommit:"9f8ebd171479bec0ada837d7ee641dec2f8c6dd1", GitTreeState:"clean", BuildDate:"2018-03-21T15:21:50Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"windows/amd64"}
error: You must be logged in to the server (the server has asked for the client to provide credentials)
</code></pre>

<h2>minikube directories and files</h2>

<pre><code>    Directory: C:\Users\robert\.minikube


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        3/22/2018   1:40 PM                addons
d-----        3/22/2018   1:40 PM                cache
d-----        3/22/2018   1:40 PM                certs
d-----        3/22/2018   1:47 PM                config
d-----        3/22/2018   1:40 PM                files
d-----        3/22/2018   1:40 PM                logs
d-----        3/22/2018   9:42 PM                machines
d-----        3/22/2018   2:32 PM                profiles
-a----        3/22/2018  10:56 PM           1298 apiserver.crt
-a----        3/22/2018  10:56 PM           1679 apiserver.key
-a----        3/22/2018   2:33 PM           1066 ca.crt
-a----        3/22/2018   2:33 PM           1675 ca.key
-ar---        3/22/2018  10:55 PM           1054 ca.pem
-ar---        3/22/2018  10:55 PM           1094 cert.pem
-a----        3/22/2018  10:56 PM           1103 client.crt
-a----        3/22/2018  10:56 PM           1675 client.key
-ar---        3/22/2018  10:55 PM           1679 key.pem
-a----        3/22/2018   7:29 PM             29 last_update_check
-a----        3/22/2018   2:33 PM           1074 proxy-client-ca.crt
-a----        3/22/2018   2:33 PM           1675 proxy-client-ca.key
-a----        3/22/2018  10:56 PM           1103 proxy-client.crt
-a----        3/22/2018  10:56 PM           1675 proxy-client.key
</code></pre>

<h2>minikube logs</h2>

<pre><code>Mar 23 03:04:18 minikube localkube[2997]: I0323 03:04:18.212816    2997 ready.go:30] Performing healthcheck on https://localhost:8443/healthz
Mar 23 03:04:18 minikube localkube[2997]: E0323 03:04:18.219072    2997 ready.go:40] Error performing healthcheck: Get https://localhost:8443/healthz: x509: certificate has expired or is not yet valid
Mar 23 03:04:18 minikube localkube[2997]: http: TLS handshake error from 127.0.0.1:41884: remote error: tls: bad certificate
Mar 23 03:04:19 minikube localkube[2997]: I0323 03:04:19.212786    2997 ready.go:30] Performing healthcheck on https://localhost:8443/healthz
Mar 23 03:04:19 minikube localkube[2997]: E0323 03:04:19.219637    2997 ready.go:40] Error performing healthcheck: Get https://localhost:8443/healthz: x509: certificate has expired or is not yet valid
Mar 23 03:04:19 minikube localkube[2997]: http: TLS handshake error from 127.0.0.1:41886: remote error: tls: bad certificate
</code></pre>

<h2>Certificate details</h2>

<pre><code>openssl x509 -in apiserver.crt -text -noout
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 2 (0x2)
    Signature Algorithm: sha256WithRSAEncryption
        Issuer: CN=minikubeCA
        Validity
            Not Before: Mar 23 18:05:14 2018 GMT
            Not After : Mar 23 18:05:14 2019 GMT
        Subject: O=system:masters, CN=minikube
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (2048 bit)
                Modulus:
                    00:b5:fa:...fa:e7
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Key Usage: critical
                Digital Signature, Key Encipherment
            X509v3 Extended Key Usage:
                TLS Web Server Authentication, TLS Web Client Authentication
            X509v3 Basic Constraints: critical
                CA:FALSE
            X509v3 Subject Alternative Name:
                DNS:minikubeCA, DNS:kubernetes.default.svc.cluster.local, DNS:kubernetes.default.svc, DNS:kubernetes.default, DNS:kubernetes, DNS:localhost, IP Address:192.168.99.100, IP Address:10.96.0.1, IP Address:10.0.0.1
    Signature Algorithm: sha256WithRSAEncryption
         47:88:26:93:d2.....
         ab:b1:8a:43
</code></pre>

<p>First, as reported <a href="https://github.com/kubernetes/minikube/issues/2317#issuecomment-351497305" rel="nofollow noreferrer">here</a> or <a href="https://github.com/kubernetes/minikube/issues/2464#issuecomment-361143511" rel="nofollow noreferrer">here</a>, check if the issue persists in the latest version (0.25.2, which <em>just</em> got released a few hours ago)</p>

<p>Second, check how your certificate is formed (as <a href="https://github.com/kubernetes/minikube/issues/2361#issuecomment-356208073" rel="nofollow noreferrer">in this issue</a>)</p>

<pre><code>openssl x509 -in apiserver.crt -text -noout
</code></pre>

<p>And/or try to <a href="https://github.com/kubernetes/minikube/issues/288#issuecomment-231423876" rel="nofollow noreferrer">regenerate the token</a>.</p>
