-
Notifications
You must be signed in to change notification settings - Fork 813
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
Allow manual set of service account #670
Conversation
jupyterhub/values.yaml
Outdated
@@ -51,7 +51,7 @@ hub: | |||
|
|||
rbac: | |||
enabled: true | |||
|
|||
serviceAccount: '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will actually have a kubernetes ServiceAccount
object even though the value rbac.serviceAccount
in values.yaml
is left blank. I'm thinking that if we name the value rbac.customServiceAccount
we might indicate the behavior of the setting better. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm fine with it
eb92692
to
b28fe71
Compare
Signed-off-by: Gaetan Semet <gaetan@xeberon.net>
@gsemet thank you for the PR! It exposes a piece of missing knowledge to me that I need to figure out, I love it!! I'm currently trying to grasp Thinking aloud...A cluster administrator or someone who would be allowed to create kubernetes objects through helm / kubectl. Is that user allowed to do certain things, but not all, like create a pod, but not a A How I can progress...
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
creationTimestamp: 2018-01-01T23:58:20Z
name: cluster-admin-binding
resourceVersion: "690"
selfLink: /apis/rbac.authorization.k8s.io/v1/clusterrolebindings/cluster-admin-binding
uid: asdfasdf-asdf-asdf-asdf-asdfasdfasdf
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: User
name: <MY-EMAIL-ADDRESS> Update 1So ClusterRoleBindings can tie together a |
Hi. I must admit my limited knowledge as well on this subjet. On our baremetal kubenertes, we cannot create ClusterRoleBinding at all in our namespace, which is understandable because it might allows easy escalation of priviledge out of our namespace. The underneath reason might be that jupyterhub does not need a ClusterRoleBinding/ClusterRole. |
My understanding is a ClusterRole has privileges across all namespaces, whereas a Role can only operate inside a single namespace. I don't know why the image-puller requires a ClusterRole instead of a Role. |
@gsemet you helped me understand things better! Thank you! @manics good point, hmmm, so it will speak with the kubernetes api server, asking it about a daemonset, but it does not need to find daemonsets outside its namespace... It previously required privilege to create deaemonsets but no longer... Update 1@manics I created issue #671 to address this! Update 2manics was right, it didn't require a ClusterRole, so I created #674 to solve it. |
@gsemet as I understand it. Your I think @manics is correct in that the image-awaiter job utilizing the ServiceAccount / ClusterRole / ClusterRolebinding in image-puller's If you fix #671, I think you solved your problem! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are several places where the service account are created, at least: puller (that I don't use), culler (that I use) and the https proxy (that I don't use). For simplicity I have set all to use the same hardcoded service account (I actually use the service account used by Tiller). So I agree my solution is not clean, but it works. I however do not have the time to work on it for the moment, but if one manage to restrict the roles to the namespace I think that would do the job perfectly! |
@gsemet oh, do you have automatic https enabled? Then I think the following clusterrolebinding being created is that which is overstepping your permissions, and fixing the image-puller overstepping won't help you, as if it is disabled you won't create any clusterrolebinding there no matter what.
|
we don't have https against our internal jupyter... but I think it will not have any impact, since we do'nt use nginx ingress. Traefik is really a good ingress. It already handles some https so it may not be difficult to turn https on against jupyter when the day comes :) |
@gsemet I just created #674, if that PR is implemented and you do not use the automatic letsencrypt funcionality, nothing will require a ClusterRoleBinding as far as I know, and you won't need to override the ServiceAccount's used to the very permissive Tiller account. Oh but wait a second I confused myself! You had disabled the hook-image-puller, by setting :D Confusion! I'm not confident at all about the situation, are you not allowed to create a ServiceAccount? I understand them as placeholder accounts until they are tied to some Role or ClusterRole (predefined or manually created) through a RoleBinding or ClusterRoleBinding. |
Yes service account can be easily created, it is the role that are restricted ! I have disabled the prepuller because it didn’t Worked (didn’t it need the docker socket at one point?). I can try it again but yes, I have disabled it on our prod |
@gsemet I'm still quite confused, but this is my current understanding of the situation.
|
Yes :) I will try #674 patch ASAP (probably not before 2 weeks) ! And I probably been over hacky when I disabled everything that wasn’t working instead of trying to make it work.
We are investigating on how we can extra level of security (TLS on helm, ...) so we are learning everyday ! Thanks for your patience and support :) |
@gsemet I'm excited about the setup you have! I figure it may be essential to be able to use z2jh-k8s on baremetal for many administrators in the end and you are leading the way to making things work! I appreciate the possibility to learn from your experiences! :D |
Hi, not tried. I will try it today |
@gsemet my current understanding I've arrived to by learning through your experiences is that we should aim to avoid creating any Currently, I think only the autohttps setup requires a I'll close PR this for now. I'm very thankful that you made it, I got to learn a lot and now I know what we should aim for better. Perhaps an upgrade from kube-lego to cert-manager, or what @minrk suggests in #710 might do the trick of getting rid of the last |
This allows to disable the automatic creation of the service account (that requires clusterbinding priviledge) and define the service account for jupyter (hub and proxy) to use
Signed-off-by: Gaetan Semet gaetan@xeberon.net