You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Workers spawned in kubernetes mode do not inherit service account from runner #2992
Workers spawned by runners in kubernetes mode should retain the service account of the runner that spawned them. Currently, spawned workers are using the default service account instead of the service account I have assigned to my workers.
Why is this needed?
This breaks IRSA in EKS, which depends on the service account to grant AWS permissions to the pod.
Additional context
It looks like this same issue was mentioned in #2754 but that issue was closed with no clear resolution.
I would not agree that the job pods created by the hook should inherit the service account assigned to the runner pod. Job pods should not be an extension of the runner, but rather the container in which the workflow should be executed. The runner needs to have permissions, so it can create the container with appropriate resources.
However, you can customize your job pods by leveraging hook extensions explained here.
In your runner scale set template (in the values file for the helm chart), mount the configmap as a volume, and refer to its location with the ACTIONS_RUNNER_CONTAINER_HOOK_TEMPLATE env var:
Hi, I am trying to applying the solution provided by @johnjeffers but without sucess. I am trying to run a terraform container as a job pod, but I always get the "no valid credential sources found" when trying to run a terraform plan.
I have created the IRSA properly and it works fine when I assign it to a customized pod that I am testing.
When my runner and job pods are created, I can see that the container and the dind are getting the role properly:
@ArnaldoMoralesSirt Things have changed since I posted that. If you look at the values file for the runner scale set chart, you'll see what your DinD template should look like now.
So you basically just need to copy the format of the DinD template from the values file, but add a line for the serviceaccount that's tied to your IRSA role, plus any other changes you'd like to customize your DinD runner.
I would like to automate Helm deployment within my EKS cluster and I struggling because at the helm step the runner launches a workflow pod which has the default service account which is not allowed to interact with the cluster.
I can't find where I can set the service account for the workflow pods (which I assume are the job pods) in kubernetes mode.
I've tried the solution with the hook extensions but it seems to be out of date (since 2 days) and indeed it doesn't work.
Reacted by Bernardo Salazar, Greg Dubicki, Luke Barratt and finchr
Hello @gdubicki
Yes I did find a workaround that works well.
I didn't invent anything, I juste tried something that was mentioned here with the podTemplate and it works even if it's considered out of date.
@johnjeffers Thank you so much for your solution, you saved my day ;-)
Just to add my 2 cents, you can also only patch what is in the template using YAML override
In my case I just needed to override 2 parameters:
Activity
github-actions commentedon Oct 15, 2023
Hello! Thank you for filing an issue.
The maintainers will triage your issue shortly.
In the meantime, please take a look at the troubleshooting guide for bug reports.
If this is a feature request, please review our contribution guidelines.
nikola-jokic commentedon Oct 16, 2023
Hey @johnjeffers,
I would not agree that the job pods created by the hook should inherit the service account assigned to the runner pod. Job pods should not be an extension of the runner, but rather the container in which the workflow should be executed. The runner needs to have permissions, so it can create the container with appropriate resources.
However, you can customize your job pods by leveraging hook extensions explained here.
johnjeffers commentedon Oct 16, 2023
Update 2024-05-08 -- this is out of date now. See below.
@nikola-jokic thanks, that's the piece of the puzzle I was missing. I was able to get the workers running with the service account that I needed.
If anyone else runs into this problem, here's how I solved it.
Create a configmap with a pod template that specifies the
serviceAccountNameyou want the workers to use:In your runner scale set template (in the values file for the helm chart), mount the configmap as a volume, and refer to its location with the
ACTIONS_RUNNER_CONTAINER_HOOK_TEMPLATEenv var:nikola-jokic commentedon Oct 16, 2023
Thank you for providing a write-up!
ArnaldoMoralesSirt commentedon Apr 27, 2024
Hi, I am trying to applying the solution provided by @johnjeffers but without sucess. I am trying to run a terraform container as a job pod, but I always get the "no valid credential sources found" when trying to run a terraform plan.
I have created the IRSA properly and it works fine when I assign it to a customized pod that I am testing.
When my runner and job pods are created, I can see that the container and the dind are getting the role properly:
Any idea about how to solve this? Thanks.
johnjeffers commentedon May 8, 2024
@ArnaldoMoralesSirt Things have changed since I posted that. If you look at the values file for the runner scale set chart, you'll see what your DinD template should look like now.
https://github.com/actions/actions-runner-controller/blob/master/charts/gha-runner-scale-set/values.yaml#L113
So you basically just need to copy the format of the DinD template from the values file, but add a line for the
serviceaccountthat's tied to your IRSA role, plus any other changes you'd like to customize your DinD runner.So, you start with this:
Add/change what you need, to end up with something like this. Comments inline for anything that was added or changed.
NicolasEspiau-stilll commentedon May 10, 2024
hello everyone,
I have the same issue but in kubernetes mode.
I would like to automate Helm deployment within my EKS cluster and I struggling because at the helm step the runner launches a workflow pod which has the default service account which is not allowed to interact with the cluster.
I can't find where I can set the service account for the workflow pods (which I assume are the job pods) in kubernetes mode.
I've tried the solution with the hook extensions but it seems to be out of date (since 2 days) and indeed it doesn't work.
gdubicki commentedon May 22, 2024
I think I am having the same problem as you, @NicolasEspiau-stilll, although it my case it's GKE, but I don't think it matters for now.
Did you manage to resolve this?
NicolasEspiau-stilll commentedon May 23, 2024
Hello @gdubicki
Yes I did find a workaround that works well.
I didn't invent anything, I juste tried something that was mentioned here with the podTemplate and it works even if it's considered out of date.
That's the only thing that solve my issue so far.
cedef commentedon Sep 17, 2024
@johnjeffers Thank you so much for your solution, you saved my day ;-)
Just to add my 2 cents, you can also only patch what is in the template using YAML override
In my case I just needed to override 2 parameters: