Provide serviceAccount token as token file in Slurm #46
Replies: 13 comments 11 replies
-
Some useful info thanks to @dciangot
|
Beta Was this translation helpful? Give feedback.
-
Ok I see a (long painful) path.
The content should be in pod creation request from VK to API to Plugin.
is translated to Singularity |
Beta Was this translation helpful? Give feedback.
-
Ok first draft attempt to get token works!
Now @dciangot I think I need to create token, ca.crt, namespace files and put these in PodCreateRequest (https://github.com/interTwin-eu/interLink/blob/main/pkg/interlink/types.go#L10), I need to add a volumes field I think. What do you think? No urgency, I will continue the work next year! |
Beta Was this translation helpful? Give feedback.
-
Just one quick comment. The projected accounts token will be rotated each hour. |
Beta Was this translation helpful? Give feedback.
-
Hi Diego, the correct implementation would be for InterLink VK to do the same as what kubelet does: when 80% of expiration time is passed, then it should reask a new token, and provide them to InterLink API, then Plugin. The Slurm Plugin should have a way to trigger or undergo the rotation (either by listening to API with a port, or by polling regularly, or because it knows when a token should expire). |
Beta Was this translation helpful? Give feedback.
-
One thing I am not sure though is, after giving token to Slurm job, how to give it access to Kubernetes API? I suggest exposing Kubernetes API :
I feel the easiest way and most compatible way to deploy is the first one (NodePort). |
Beta Was this translation helpful? Give feedback.
-
As you say @antoinetran , it is so much work and so much of a burden to maintain that I'm not sure it is worth. Just to be aligned, did you check the path where you create the "infinite" service token manually so to avoid the projectedVolume one? I suspect anything else would be an hack around it. Also, regarding argo workflows, I still think that a custom executor engine would be something to look at, I'll try to give it a look later this week. |
Beta Was this translation helpful? Give feedback.
-
Yes, either 1 or 2 I think are good options. That btw, are outside the plugin and interlink ballpark, right? |
Beta Was this translation helpful? Give feedback.
-
I don't think we can avoid projectedVolume. To me, the kubelet automatically converts serviceAccount to a projected volumes in the yaml. So to answer your question, the path field always exist. |
Beta Was this translation helpful? Give feedback.
-
Would gladly receive more help, maybe in Slack, but from what I see, it seems to me that maybe some hack can be done with argo plugin executor but it needs lot of work. |
Beta Was this translation helpful? Give feedback.
-
Yes, the more I think of it, the more I think any way to talk to Kubernetes API should be outside InterLink scope. Of course it can provide some example. I initially thought something could be done in the way InterLink already provides bastionSSH, so with a node port and ssh tunnel, we can access Kubernetes API. But that is not always the cleanest way (eg in Kind, the nodeport does not work unless we also map the host port). |
Beta Was this translation helpful? Give feedback.
-
Alright @antoinetran , I converted this into a discussion, so we can define the way to go in here and then open the issues where its needed. So, let me recap and see if we can agree on this (then I'll circulate the topic in slack to have comments from other interested people):
The implementation form 1 to 3 is the step 0 that we can insert without API changes, IF we make VK killing the pod when token lifetime comes to an end. Then, 4-5 can come later, in a 0.4.x where also other apis are likely to change. What do you think? |
Beta Was this translation helpful? Give feedback.
-
What are the environment variables related to Kubernetes API to add? Here are those from any pod, from a Kind cluster:
Some of them are described in official Kubernetes docs. The kubelet code responsible for these: https://github.com/kubernetes/kubernetes/blob/v1.9.0/pkg/kubelet/envvars/envvars.go#L45-L48 So I will add these to InterLink Config (https://github.com/interTwin-eu/interlink-helm-chart/blob/main/interlink/templates/virtual-kubelet-config.yaml#L7):
If these values are not present, no env will be added by VK. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Short Description of the issue
When serviceAccount field is filled (even for default one called "default"), the pod in Kubernetes automatically receive the token to talk to kubernetes API
Additionally, the kubelet automatically add environment variables that contains Kubernetes API address and port (thanks to https://github.com/kubernetes/kubernetes/blob/v1.9.0/pkg/kubelet/envvars/envvars.go#L45-L48):
There are other KUBERNETES variables, but these two are the minimum for my test case, Argo, to be able to communicate to Kubernetes API.
Environment
Steps to reproduce
deploy any pod, even with the default serviceAccount, this should not be in error
Logs, stacktrace, or other symptoms
Summary of proposed changes
See below
Beta Was this translation helpful? Give feedback.
All reactions