fluxcd / multi-tenancy

Flux v1: Manage a multi-tenant cluster with Flux and Kustomize

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rbac issue on team namespace

moh-abk opened this issue · comments

I've followed the guide and I'm getting this issue;

ts=2019-10-09T11:14:19.220962472Z caller=main.go:243 version=1.14.2
ts=2019-10-09T11:14:19.220997437Z caller=main.go:372 msg="using in cluster config to connect to the cluster"
ts=2019-10-09T11:14:19.292022192Z caller=main.go:450 err="secrets \"flux-git-deploy\" is forbidden: User \"system:serviceaccount:adam:flux\" cannot patch resource \"secrets\" in API group \"\" in the namespace \"adam\": RBAC: [clusterrole.rbac.authorization.k8s.io \"flux-readonly\" not found, clusterrole.rbac.authorization.k8s.io \"flux-psp\" not found]"

adam is the name of the team. any ideas?
the flux-git-deploy secret get's created but is empty.

this might be because I'm using flux 1.14.2 as 1.15.0 errors with - Failed to pull image "weaveworks/flux:1.15.0": rpc error: code = Unknown desc = Error response from daemon: manifest for weaveworks/flux:1.15.0 not found

There are 2 different bugs, let me fix the image first.

thanks - I've raised - fluxcd/flux#2507

About RBAC when you applied the team1 did it worked? I'm guessing you've created adam with the script right?

yes I used the script; i never tested with team1

with updated flux i get;

ts=2019-10-09T12:11:06.494326802Z caller=main.go:248 version=1.15.0
ts=2019-10-09T12:11:06.494373283Z caller=main.go:383 msg="using in cluster config to connect to the cluster"
ts=2019-10-09T12:11:06.697644963Z caller=main.go:461 err="secrets \"flux-git-deploy\" is forbidden: User \"system:serviceaccount:adam:flux\" cannot patch resource \"secrets\" in API group \"\" in the namespace \"adam\""

this fixed the issue - kubectl create clusterrolebinding kube-system-cluster-admin --clusterrole=cluster-admin --serviceaccount=adam:flux

Ok looks like there is a bug in kustomize v3.2.0.

Replace command: kustomize build . with command: kubectl kustomize . in .flux.yaml and start all over.

does this apply to the .flux.yaml in the team repo also?

If it works in the system flux repo then it should work in the team repo as well.

I've found a fix for it, see #9

thanks - that works 🙏 - does this setup work with Helm charts?

You could deploy a Tiller and Helm Operator per namespace. Ok I'm merging #9 if that solves it. Thanks for the bug report 👍