High number of Tokens on Rancher Manager
This document (000021439) is provided subject to the disclaimer at the end of this document.
Environment
SUSE Rancher 2.7.x
Situation
The number of tokens can be checked running:
kubectl get tokens | wc -l
Resolution
You should have minimized the number of tokens. Anything over 5000 could impact the performance.
You can get the tokens by running:
kubectl get tokens -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.metadata.creationTimestamp}{"\n"}'
Export that to a file and sort it by the desired date.
You can then pass the file to a script like this one. This will delete all the tokens in the file:
#!/bin/bash TOKENS_FILENAME=$1 while IFS= read -r line do token=($line) kubectl patch tokens.management.cattle.io/$token \ --type json \ --patch='[ { "op": "remove", "path": "/metadata/finalizers" } ]' kubectl delete token $token done < "$TOKENS_FILENAME"
Disclaimer
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.
- Document ID:000021439
- Creation Date: 22-Apr-2024
- Modified Date:03-May-2024
-
- SUSE Rancher
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com