#community-help

API Key Becomes Invalid in Long Running Cluster

TLDR Adrian experienced an invalid generated API key. Jason explained that the key's expiration parameters and possible cluster quorum changes may have affected the key's validity.

Powered by Struct AI
8
4mo
Solved
Join the chat
May 22, 2023 (4 months ago)
Adrian
Photo of md5-27ff63286c7b3dcb91085f39e910c437
Adrian
06:55 PM
I am curious under what situations a generated API key becomes invalid. I have a long running cluster which I generated a key for which is no longer accepted by the cluster. The cluster has lost quorum since the key was generated (and there have been forced resets), but there should have been no loss of persisted data. We are running in k8s
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
07:25 PM
There’s an expires_at param that controls the expiration.
07:26
Jason
07:26 PM
You can fetch API key metadata by doing a GET /keys API call, to see all the active API keys
07:26
Jason
07:26 PM
If you had created a scoped api key, that can have its own expiration embedded
Adrian
Photo of md5-27ff63286c7b3dcb91085f39e910c437
Adrian
09:09 PM
hmm. I did not set expires_at when creating the key. GET /keys returns no results
09:12
Adrian
09:12 PM
are the keys a cluster knows persisted to disk? Or only in memory?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
10:27 PM
Keys are persisted to disk
10:28
Jason
10:28 PM
It’s possible that enough nodes were replaced afresh, so the older cluster lost quorum and the new nodes might have ended up forming a quorum among themselves as a brand new cluster with an empty data directory, instead of syncing data from the existing cluster.