github.com/darmach/terratest@v0.34.8-0.20210517103231-80931f95e3ff/examples/kubernetes-basic-example/README.md (about) 1 # Kubernetes Basic Example 2 3 This folder contains a minimal Kubernetes resource config file to demonstrate how you can use Terratest to write 4 automated tests for Kubernetes. 5 6 This resource file deploys an nginx container as a single pod deployment with a node port service attached to it. 7 8 See the corresponding terratest code for an example of how to test this resource config: 9 - [kubernetes_basic_example_test.go](../../test/kubernetes_basic_example_test.go) for the most basic verification 10 - [kubernetes_basic_example_service_check_test.go](../../test/kubernetes_basic_example_service_check_test.go) for a more 11 advanced version of checking the service. 12 13 14 ## Deploying the Kubernetes resource 15 16 1. Setup a Kubernetes cluster. We recommend using a local version: 17 - [minikube](https://github.com/kubernetes/minikube) 18 - [Kubernetes on Docker For Mac](https://docs.docker.com/docker-for-mac/kubernetes/) 19 - [Kubernetes on Docker For Windows](https://docs.docker.com/docker-for-windows/kubernetes/) 20 21 1. Install and setup [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) to talk to the deployed 22 Kubernetes cluster. 23 1. Run `kubectl apply -f nginx-deployment.yml` 24 25 26 ## Running automated tests against this Kubernetes deployment 27 28 1. Setup a Kubernetes cluster. We recommend using a local version: 29 - [minikube](https://github.com/kubernetes/minikube) 30 - [Kubernetes on Docker For Mac](https://docs.docker.com/docker-for-mac/kubernetes/) 31 - [Kubernetes on Docker For Windows](https://docs.docker.com/docker-for-windows/kubernetes/) 32 33 1. Install and setup [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) to talk to the deployed 34 Kubernetes cluster. 35 1. Install and setup [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/). 36 1. Install [Golang](https://golang.org/) and make sure this code is checked out into your `GOPATH`. 37 1. `cd test` 38 1. `dep ensure` 39 1. `go test -v -tags kubernetes -run TestKubernetesBasicExample` 40 1. You can also run `TestKubernetesBasicExampleServiceCheck`