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

Fleet container fails: /var/run/secrets/kubernetes.io/serviceaccount/token: permission denied #790

Open
patrijua opened this issue Jun 9, 2022 · 5 comments

Comments

@patrijua
Copy link

patrijua commented Jun 9, 2022

With Rancher v2.6.3 running in AWS EKS with kubernetes version 1.21, fleet fails to reconcile the downstream cluster because "fleet" container fails. Previous "step-git-source" is successful and clones the git repository.

containerStatuses:
 - name: fleet
state:
terminated:
exitCode: 1
reason: Error
message: >
 time="2022-06-08T11:46:40Z" level=fatal msg="open
 /var/run/secrets/kubernetes.io/serviceaccount/token: permission
 denied"

Seems that the user running the pod (1000) does not have access to token. I did a test by modifying the pod definition to run as root and triggered the pod manually, then fleet container was ran successfully.

  securityContext:
    runAsUser: 0
@patrijua
Copy link
Author

patrijua commented Jun 9, 2022

Any advice on effective workaround? I tried to modify the related CRD object (gitjobs.gitjob.cattle.io) but the modification does not stay, it immediately returns back to original.

@patrijua
Copy link
Author

patrijua commented Jun 9, 2022

Related? kubernetes-sigs/external-dns#1185

@patrijua
Copy link
Author

Also setting the fsgroup on the related gitjobs.gitjob.cattle.io object can be used as a workaround.

securityContext: fsGroup: 65534 runAsUser: 1000

@aiyengar2
Copy link
Contributor

@patrijua it does seem to be related to the issue you linked. Relevant snippet from AWS documentation in https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts-technical-overview.html.

By default, only containers that run as root have the proper file system permissions to read the web identity token file. You can provide these permissions by having your containers run as root, or by providing the following security context for the containers in your manifest.

However, the followup workaround you listed seems to contradict this since runAsUser 1000 (non-root) seemed to work as expected?

@patrijua
Copy link
Author

Both workarounds did work. Either run as root OR run as 1000 and add fsGroup: 65534 to securityContext.

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

3 participants