Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

[k8s 1.21] BoundServiceAccountTokenVolume refresh token #651

Closed
mo-saeed opened this issue May 16, 2022 · 3 comments
Closed

[k8s 1.21] BoundServiceAccountTokenVolume refresh token #651

mo-saeed opened this issue May 16, 2022 · 3 comments
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@mo-saeed
Copy link

mo-saeed commented May 16, 2022

Kubernetes version 1.21 graduated BoundServiceAccountTokenVolume feature [1] to beta and enabled it by default. This feature improves security of service account tokens by requiring a one hour expiry time, over the previous default of no expiration. This means that applications that do not refetch service account tokens periodically will receive an HTTP 401 unauthorized error response on requests to Kubernetes API server with expired tokens.

In our kubernetes audit logs we see that kubernetes dashboard still using stale tokens

"authentication.k8s.io/stale-token":"subject: system:serviceaccount:kube-infrastructure:helm-operator, seconds after warning threshold: 1200715"

As per my understanding, that should be fixed by upgrading kubernetes client to latest release Go v0.15.7 and later

To Reproduce
install helm-operator in kubernetes cluster with version >= 1.21 and check the kubernetes audit logs for stale-token

Expected behavior

A clear and concise description of what you expected to happen.

Additional context

  • Helm Operator version: latest
  • Kubernetes version: 1.22

As per my understanding, that should be fixed by upgrading kubernetes client SDK to latest release Go v0.15.7 and later

@mo-saeed mo-saeed added blocked needs validation In need of validation before further action bug Something isn't working labels May 16, 2022
@pjbgf
Copy link
Member

pjbgf commented May 16, 2022

This is a duplicate of fluxcd/flux#3610. I would recommend tuning in that thread for latest information around the issue.

@pjbgf
Copy link
Member

pjbgf commented Jul 27, 2022

We have recently upgraded most dependencies (including AWS SDK) and shall release a new version in the coming days. That is mostly to mitigate security vulnerabilities, but we are not completely sure that would suffice to fix this problem.

A workaround for this issue is to force the pod to be restarted before the token expiration period (in EKS' case that is 90 days). That could be achieved with a Kubernetes CronJob or by simply redeploying Flux within that time frame.

Unfortunately, we won't be able to fix the root cause of this issue as Flux v1 is in Migration and security support only. We recommend users to migrate to Flux 2 at their earliest convenience so they don't encounter other issues as newer Kubernetes versions may degrade Flux v1 operations.

More information about the Flux 2 transition timetable can be found at: https://fluxcd.io/docs/migration/timetable/.

@pjbgf pjbgf closed this as completed Jul 27, 2022
@pjbgf pjbgf added the wontfix This will not be worked on label Jul 27, 2022
@kingdonb
Copy link
Member

kingdonb commented Aug 2, 2022

It looks like there's some complicated nuance to this issue that explains why it did not solve anything to upgrade the client-go package: fluxcd/helm-controller#480

That being said, it should be noted that this issue has been resolved in Helm Controller since the 0.31 Flux v2 release in May.

@kingdonb kingdonb removed the blocked needs validation In need of validation before further action label Aug 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants