---
title: "check your kubeconfig expire time"
description: "Today I learned an important lesson that you should periodically check on your kubeconfigs expiration date. It's easy to do. You can ask for the..."
date: 2025-12-08
published: true
tags:
  - kubenetes
template: til
---


Today I learned an important lesson that you should periodically check on your
kubeconfigs expiration date.  It's easy to do.  You can ask for the
client-certificate-data from your kubeconfig, decode it, and use openssl to get
the expiration date.

``` bash
kubectl config view --raw -o jsonpath='{.users[0].user.client-certificate-data}' \
  | base64 -d 2>/dev/null \
  | openssl x509 -noout -dates
```

!!! Note

    This will only work for the first user, if you have more than one user or
    context defined in your kubeconfig you will need to adjust.
