Skip to content

Latest commit

 

History

History
36 lines (26 loc) · 1.75 KB

File metadata and controls

36 lines (26 loc) · 1.75 KB

Kubernetes RBAC Example

This folder contains a Kubernetes resource config file that creates a new Namespace and a ServiceAccount that has admin level permissions in the Namespace, but nowhere else. This example is used to demonstrate how you can test RBAC permissions using terratest.

See the corresponding terratest code (kubernetes_rbac_example_test.go) for an example of how to test this resource config:

Deploying the Kubernetes resource

  1. Setup a Kubernetes cluster. We recommend using a local version:

  2. Install and setup kubectl to talk to the deployed Kubernetes cluster.

  3. Run kubectl apply -f namespace-service-account.yml

Running automated tests against this Kubernetes deployment

  1. Setup a Kubernetes cluster. We recommend using a local version:

  2. Install and setup kubectl to talk to the deployed Kubernetes cluster.

  3. Install and setup kubectl.

  4. Install Golang and make sure this code is checked out into your GOPATH.

  5. cd test

  6. dep ensure

  7. go test -v -tags kubernetes -run TestKubernetesRBACExample