-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
An experimental support for authn/authz w/ RBAC utilizing kube-rbac-p…
…roxy Pre-requisites: - Build the helm binary from this commit and place it in `$GOPATH/src/k8s.io/helm/bin/helm` - Build the tiller docker image from this commit and push to mumoshu/tiller:canary - Build a kube-rbac-proxy image from the latest master of https://github.com/brancz/kube-rbac-proxy and tag it mumoshu/kube-rbac-proxy:v0.2.0 Usage: ``` # 1. Update the tiller deployment $ k edit deploy tiller-deploy # 1-1. Modify the tiller container to listen on an another port while enabling the experimental auth feature - args: - --experimental-rbac-proxy - --listen - :44137 command: - /tiller image: mumoshu/tiller:canary # 1-2. Add kube-rbac-proxy is a sidecar container - args: - --alsologtostderr - --v=10 - --insecure-listen-address=:44134 - --upstream=http://127.0.0.1:44137/ - --upstream-force-h2c - --auth-header-fields-enabled - --auth-header-user-field-name=x-forwarded-user - --auth-header-groups-field-name=x-forwarded-groups image: mumoshu/kube-rbac-proxy:v0.2.0 imagePullPolicy: IfNotPresent name: kube-rbac-proxy ports: - containerPort: 44134 name: grpc protocol: TCP # 2. Create a serviceaccount for testing purpose $ k create serviceaccount permissive-sa $ k create clusterrolebinding permissive-binding --clusterrole=cluster-admin --serviceaccount=permissive-sa $ secret=<permissive-sa's secret name> $ token=$(k get secret $secret -o json | jq -r '.data.token' | base64 -D) $ k config set-credentials permissive-sa --token $token # 3. Create a invalid serviceaccount for testing purpose $ kubectl config set-credentials invalid-sa --token somerandomstring # 4. Test it! # 4-1. A k8s user who is authenticated and authorized to to access tiller can list helm releases $ kubensx use #=> user: permissive-sa $ $GOPATH/src/k8s.io/helm/bin/helm list --debug --experimental-rbac-auth-proxy # 4-2. A k8s user who is not authenticated can not access tiller # # Note that the error message is unintuitive at the moment! $ kubensx use #=> user: invalid-sa $ $GOPATH/src/k8s.io/helm/bin/helm list --debug --experimental-rbac-auth-proxy [debug] Created tunnel using local port: '56945' [debug] SERVER: "127.0.0.1:56945" Error: transport: received the unexpected content-type "text/plain; charset=utf-8" ``` Exercise: - Create a kube-rbax-procy resource-attributes file to restrict the serviceaccount to only access specific tiller APIs. Note that a gRPC call results in an HTTP/2 request to the path /<package.Type>/<method> so you can use nonResourceURLs to write policies for gRPC calls. Future work: - Tiller impersonates as the authenticated user
- Loading branch information
Showing
5 changed files
with
119 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters