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

[stable/traefik] RBAC support for Traefik #1225

Merged
merged 3 commits into from
Jun 29, 2017

Conversation

cknowles
Copy link
Contributor

@cknowles cknowles commented Jun 2, 2017

For #948.

When switching RBAC from true to false, the serviceAccountName stays
as the Traefik specific one so set it to default. Not sure if this is
a Helm issue or further upstream.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 2, 2017
@k8s-ci-robot
Copy link
Contributor

Hi @c-knowles. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with @k8s-bot ok to test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 2, 2017
@skorski
Copy link

skorski commented Jun 3, 2017

Hi @c-knowles, I used this successfully once on a cluster but now I'm getting an error

Error: release righteous-snake failed: clusterroles.rbac.authorization.k8s.io "righteous-snake-traefik-dev" is 
forbidden: attempt to grant extra privileg]} {[watch] [] [pods] [] []} {[get] [] [services] [] []} {[list] [] [services] [] 
[]} {[watch] [] [services] [] []} {[get] [] [endpoints] [] []} {[list] } {[get] [extensions] [ingresses] [] []} {[list] 
[extensions] [ingresses] [] []} {[watch] [extensions] [ingresses] [] []}] user=&{system:serviceaccount:k9c0f 
[system:serviceaccounts system:serviceaccounts:kube-system 
system:authenticated] map[]} ownerrules=[{[create] [authorization.k8s.io] [selfsubjectaccis /apis/* /healthz 
/swaggerapi /swaggerapi/* /version]}] ruleResolutionErrors=[]

I don't think it has anything to do with your code because I can manually fill in the variables and execute the commands with a kubectl apply. Any ideas why this might happen?

@cknowles cknowles changed the title RBAC support for Traefik [stable/traefik] RBAC support for Traefik Jun 4, 2017
@cknowles
Copy link
Contributor Author

cknowles commented Jun 4, 2017

@skorski I've not seen that one before. Is that an error output from a helm install? Do you have some steps to reproduce? Also, are you setting the --service-account param when doing helm init?

@skorski
Copy link

skorski commented Jun 4, 2017

I was trying to install it after instantiating a new cluster from kargo. Turns out there were a lot of other issue with the kargo install. I dug around a bit deeper and realized kargo didn't create the cluster roles I was expecting and I'm wondering if helm didn't get the right permission set.

I'll post more information once I get to work tomorrow but your code seems sound.

Yes, I was setting the service account.

@skorski
Copy link

skorski commented Jun 5, 2017

So I did a bit more digging and as I suspected, it was related to the kargo / helm install. I thought I had the right service account but I didn't.

Tiller needs to have a service account for this to work helm thread.

These are the commands that are important:

kubectl create serviceaccount --namespace kube-system tiller
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
helm init --upgrade --service-account=tiller

@cknowles
Copy link
Contributor Author

cknowles commented Jun 6, 2017

@skorski Ok great. It seems various people are working on the Helm/Tiller side of things, e.g. more restrictive permissions, better docs etc. Good to know in the meantime though. I'm using kube-aws which right now grants more permissive access to deploys in the kube-system namespace.

@kachkaev
Copy link
Contributor

Really waiting for this. Updating traefik to 1.3 would be also great!

@krancour
Copy link
Contributor

Updating traefik to 1.3 would be also great!

That should be a separate issue and PR. Feel free to open it.

@cknowles
Copy link
Contributor Author

@krancour Any other hold ups on this? There's a couple charts with this already as pointed out by #1235 (comment) and a few other PRs in flight - #1286, #1287, #1295. I don't have much of a view on the naming, I've used rbac.enabled here but other charts are using either that or rbac.install.

@krancour
Copy link
Contributor

@c-knowles this looks pretty good to me, although I haven't tried it. Do you know with certainty that this is an adequate level of permissions Traefik (and also not more than it requires)?

One other thing is you'd have to increment the minor version number.

For helm#948.

When switching RBAC from true to false, the `serviceAccountName` stays
as the Traefik specific one so set it to `default`. Not sure if this is
a Helm issue or further upstream.
@cknowles cknowles force-pushed the feature/traefik-rbac branch from 28417ce to 22ce6a6 Compare June 28, 2017 15:07
@cknowles
Copy link
Contributor Author

@krancour the list comes directly from https://docs.traefik.io/user-guide/kubernetes/#prerequisites so I hope that it's a sufficient for the current version. As for it being the least privilege required, it seems pretty slim since it's read only on pods, services, endpoints, ingresses. I think it cannot run with anything less.

Bumped the version now and added a small note about k8s version for RBAC.

@kachkaev
Copy link
Contributor

@krancour sorry for offtopic, but I'm here regarding the version bump to 1.3.1 again. Should the PR just be like this one https://github.com/kubernetes/charts/pull/873/files?

What should be the chart version given that @c-knowles has already used 1.4.0?

@c-knowles if you are playing with the chart anyway and you have a git clone of this repo, could you please bump traefik in this or another PR?

 + 💯 for RBAC support – love it!

@cknowles
Copy link
Contributor Author

Sure, I can bump at some point just it's lower priority for us as it's easy to set the value when you do a Helm install.

@krancour
Copy link
Contributor

@kachkaev things have changed a little bit since #873.

You'd need to do the following:

  • values.yaml: imageTag to 1.3.1
  • chart.yaml: appVersion to 1.3.1
  • chart.yaml: version to... I would make a call here that bumping the chart to default to a new minor release of the software would qualify the chart itself for a minor release. So... you'd use 1.5.0, assuming @c-knowles PR gets merged first. (This is just a reality of dealing with Helm charts-- they're continuously deployed, so every merge to this repo == a release of some chart, meaning we need to always be vigilant about incrementing the version number appropriately in every PR.)

if you are playing with the chart anyway and you have a git clone of this repo, could you please bump traefik in this or another PR

I'd really like it to be a separate PR. As a general principle, lumping unrelated changes into a single PR is frowned upon. (I know the whole 1 PR == 1 release thing that I explained above increases the temptation to bundle multiple changes into a single PR, but please let's avoid it.)

@krancour
Copy link
Contributor

@c-knowles this LGTM. cc @lachie83 @viglesiasce @prydonius

@kachkaev
Copy link
Contributor

Thanks for clarifying the details @krancour! See #1401.

@cknowles cknowles deleted the feature/traefik-rbac branch June 29, 2017 07:02
mikesplain pushed a commit to barklyprotects/charts that referenced this pull request Jul 6, 2017
* RBAC support for Traefik

For helm#948.

When switching RBAC from true to false, the `serviceAccountName` stays
as the Traefik specific one so set it to `default`. Not sure if this is
a Helm issue or further upstream.

* Bump the chart version to 1.4.0

* Additional note on k8s version for RBAC
yanns pushed a commit to yanns/charts that referenced this pull request Jul 28, 2017
* RBAC support for Traefik

For helm#948.

When switching RBAC from true to false, the `serviceAccountName` stays
as the Traefik specific one so set it to `default`. Not sure if this is
a Helm issue or further upstream.

* Bump the chart version to 1.4.0

* Additional note on k8s version for RBAC
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants