> For the complete documentation index, see [llms.txt](https://platform9.com/kb/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://platform9.com/kb/pmk/solutions/how-to-increase-the-validity-of-certificate-based-kubeconfig.md).

# How to Increase the Validity of Certificate Based Kubeconfig

## Problem

How to increase the validity of certificate-based kubeconfig.

## Environment

* Platform9 Managed Kubernetes - All versions

{% hint style="warning" %}
**Warning**

* For PMK (SaaS) support team will carry out the procedure below. Please open a [Support Ticket](https://support.platform9.com/hc/en-us/requests/new).
* For PEC/SMCP (air-gapped), the steps can be performed from the management plane.
  {% endhint %}

## Procedure

{% hint style="info" %}
**Info**

How to access the Qbert Database:

* If using PEC, SSH to the management plane VM and run `mysql qbert`.

* If using SMCP, exec into the mysql exporter pod in the management plane cluster and run `mysql qbert`.
  {% endhint %}

* The default validity of certificate-based kubeconfig is 24 hours. Which is set by a parameter `certExpiryHrs` in Qbert Database.

```javascript
qbert> select id,name,uuid,status,lastOk,lastOp,taskStatus,kubeRoleVersion,certExpiryHrs from clusters\G;
```

Example:

{% tabs %}
{% tab title="mysql" %}

```javascript
qbert> select id,name,uuid,status,lastOk,lastOp,taskStatus,kubeRoleVersion,certExpiryHrs from clusters\G;
*************************** 1. row ***************************
             id: 2
           name: cluster1
           uuid: ed4153e1-0ff9-4bc0-8abb-eebad5f16e70
         status: ok
         lastOk: 2022-03-30 09:49:16.581
         lastOp: 2022-03-30 09:46:20.036
     taskStatus: success
kubeRoleVersion: 1.20.15-pmk.2100
  certExpiryHrs: 24
```

{% endtab %}
{% endtabs %}

* To increase or decrease the validity of certificate-based kubeconfig, update the `certExpiryHrs` in Qbert Database for the respective cluster.

```javascript
qbert> update clusters set certExpiryHrs='<TIME_IN_HOURS>' where uuid='<UUID_OF_CLUSTER>';
```

Example:

{% tabs %}
{% tab title="mysql" %}

```javascript
qbert> update clusters set certExpiryHrs='48' where uuid='ed4153e1-0ff9-4bc0-8abb-eebad5f16e70';

# mysql qbert -e "select id,name,uuid,status,lastOk,lastOp,taskStatus,kubeRoleVersion,certExpiryHrs from clusters\G"
*************************** 1. row ***************************
             id: 2
           name: cluster1
           uuid: ed4153e1-0ff9-4bc0-8abb-eebad5f16e70
         status: ok
         lastOk: 2022-03-30 09:53:37.353
         lastOp: 2022-03-30 09:46:20.036
     taskStatus: success
kubeRoleVersion: 1.20.15-pmk.2100
  certExpiryHrs: 48
```

{% endtab %}
{% endtabs %}

* After updating the Qbert Database, Check the validity of newly generated certificate-based kubeconfigs.

{% tabs %}
{% tab title="bash" %}

```javascript
# echo "<client_cert>" | base64 -d| openssl x509 -noout -dates
notBefore=Mar 30 09:57:04 2022 GMT
notAfter=Apr  1 09:57:34 2022 GMT
```

{% endtab %}
{% endtabs %}

Example:

{% tabs %}
{% tab title="bash" %}

```javascript
# echo "<client_cert>" | base64 -d| openssl x509 -noout -dates
notBefore=Mar 30 09:57:04 2022 GMT
notAfter=Apr  1 09:57:34 2022 GMT
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Info**

The changes made to the Qbert Database are persistent through Cluster and Management plane upgrades.
{% endhint %}

## Additional Information

Refer to the [document](https://platform9.com/kb/platform9/create-support-tickets) for instructions on how to open a support ticket.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://platform9.com/kb/pmk/solutions/how-to-increase-the-validity-of-certificate-based-kubeconfig.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
