Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Auto-refresh mTLS Credentials for Log Streaming in K9s #3141

Open
uozalp opened this issue Feb 19, 2025 · 0 comments
Open

Comments

@uozalp
Copy link
Contributor

uozalp commented Feb 19, 2025

Describe the problem
We are using Pinniped for authentication with Kubernetes, and our mTLS credentials are renewed every 5 minutes. However, when using K9s (0.40.5) to tail logs, the stream stops once the token expires, displaying the following error:

stream canceled read tcp 172.29.42.76:35550->192.168.170.32:443: use of closed network connection for mynamespace/pod

When checking my credentials:

Every 1.0s: cat ~/.config/pinniped/credentials.yaml | yq '.credentials[].credential.expirationTimestamp'
2025-02-19T12:52:42Z

As soon as this timestamp expires, K9s stops tailing logs, and I have to manually go back a view and press L again to restart log streaming.

Expected Behavior

When running:

kubectl logs -f app-6ccxvbc8f74-b5jn5 -n my-namespace

the log stream continues uninterrupted despite the credentials expiring, suggesting that kubectl refreshes tokens automatically.

Suggested Improvement

  • Add a token refresh mechanism to ensure that logs continue streaming even when credentials expire.
  • Leverage retry logic already present in K9s to detect authentication failures and re-establish the log stream with fresh credentials.

Additional Notes

  • I have looked into the K9s code and noticed there is a retry mechanism in place, but it doesn’t seem to handle token refresh.
  • I am willing to contribute a Pull Request if I can get some direction on where this logic should be implemented.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant