github.com/darmach/terratest@v0.34.8-0.20210517103231-80931f95e3ff/examples/kubernetes-rbac-example/README.md (about)

     1  # Kubernetes RBAC Example
     2  
     3  This folder contains a Kubernetes resource config file that creates a new Namespace and a ServiceAccount that has admin
     4  level permissions in the Namespace, but nowhere else. This example is used to demonstrate how you can test RBAC
     5  permissions using terratest.
     6  
     7  See the corresponding terratest code ([kubernetes_rbac_example_test.go](../../test/kubernetes_rbac_example_test.go)) for
     8  an example of how to test this resource config:
     9  
    10  
    11  ## Deploying the Kubernetes resource
    12  
    13  1. Setup a Kubernetes cluster. We recommend using a local version:
    14      - [minikube](https://github.com/kubernetes/minikube)
    15      - [Kubernetes on Docker For Mac](https://docs.docker.com/docker-for-mac/kubernetes/)
    16      - [Kubernetes on Docker For Windows](https://docs.docker.com/docker-for-windows/kubernetes/)
    17  
    18  1. Install and setup [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) to talk to the deployed
    19     Kubernetes cluster.
    20  1. Run `kubectl apply -f namespace-service-account.yml`
    21  
    22  
    23  ## Running automated tests against this Kubernetes deployment
    24  
    25  1. Setup a Kubernetes cluster. We recommend using a local version:
    26      - [minikube](https://github.com/kubernetes/minikube)
    27      - [Kubernetes on Docker For Mac](https://docs.docker.com/docker-for-mac/kubernetes/)
    28      - [Kubernetes on Docker For Windows](https://docs.docker.com/docker-for-windows/kubernetes/)
    29  
    30  1. Install and setup [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) to talk to the deployed
    31     Kubernetes cluster.
    32  1. Install and setup [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/).
    33  1. Install [Golang](https://golang.org/) and make sure this code is checked out into your `GOPATH`.
    34  1. `cd test`
    35  1. `dep ensure`
    36  1. `go test -v -tags kubernetes -run TestKubernetesRBACExample`