<p>I'm using <code>kubectl</code> to access the api server on my minikube cluster on ubuntu
but when try to use <code>kubectl</code> command I got an error certificate expired:</p>
<pre><code>/home/ayoub# kubectl get pods
Unable to connect to the server: x509: certificate has expired or is not yet valid: current time 2021-08-30T14:39:50+01:00 is before 2021-08-30T14:20:10Z
</code></pre>
<p>Here's my kubectl config:</p>
<pre><code>/home/ayoub# kubectl config view
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: DATA+OMITTED
    server: https://127.0.0.1:16443
  name: microk8s-cluster
contexts:
- context:
    cluster: microk8s-cluster
    user: admin
  name: microk8s
current-context: microk8s
kind: Config
preferences: {}
users:
- name: admin
  user:
    token: REDACTED
root@ayoub-Lenovo-ideapad-720S-13IKB:/home/ayoub#    /home/ayoub# kubectl config view
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: DATA+OMITTED
    server: https://127.0.0.1:16443
  name: microk8s-cluster
contexts:
- context:
    cluster: microk8s-cluster
    user: admin
  name: microk8s
current-context: microk8s
kind: Config
preferences: {}
users:
- name: admin
  user:
    token: REDACTED
root@ayoub-Lenovo-ideapad-720S-13IKB:/home/ayoub#
</code></pre>
<p>How I can renew this certificate?</p>

<p>Posted community wiki for better visibility. Feel free to expand it.</p>
<hr />
<p>There is similar issue opened on <a href="https://github.com/kubernetes/minikube/issues/10122" rel="nofollow noreferrer">minikube GitHub</a>.</p>
<p>The temporary workaround is to remove some files in the <code>/var/lib/minikube/</code> directory, then reset Kubernetes cluster and replace keys on the host. Those steps are described in <a href="https://github.com/kubernetes/minikube/issues/10122#issuecomment-888315632" rel="nofollow noreferrer">this answer</a>.</p>
