SUSE Support

Here When You Need Us

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.6.x
SUSE Rancher 2.7.x

Situation

Rancher 2.6.x and 2.7.x do not have a default expiration time for tokens. This can lead to excessive tokens created and impact Rancher performance.
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

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

tick icon

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

tick icon

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.