This folder contains a minimal Kubernetes resource config file to demonstrate how you can use Terratest to write automated tests for Kubernetes.
This resource file deploys an nginx container as a single pod deployment with a node port service attached to it.
See the corresponding terratest code for an example of how to test this resource config:
- kubernetes_basic_example_test.go for the most basic verification
- kubernetes_basic_example_service_check_test.go for a more advanced version of checking the service.
-
Setup a Kubernetes cluster. We recommend using a local version:
-
Install and setup kubectl to talk to the deployed Kubernetes cluster.
-
Run
kubectl apply -f nginx-deployment.yml
-
Setup a Kubernetes cluster. We recommend using a local version:
-
Install and setup kubectl to talk to the deployed Kubernetes cluster.
-
Install and setup kubectl.
-
Install Golang and make sure this code is checked out into your
GOPATH
. -
cd test
-
dep ensure
-
go test -v -run TestKubernetesBasicExample
-
You can also run
TestKubernetesBasicExampleServiceCheck