|
| 1 | +# Typhoon Kubernetes clusters on AWS |
| 2 | + |
| 3 | +This environment deploys a Kubernetes cluster using the Typhoon distribution. See here for details: https://github.com/poseidon/typhoon |
| 4 | + |
| 5 | +You will need the standard AWS environment variables to be set, e.g. |
| 6 | + |
| 7 | + - `AWS_ACCESS_KEY_ID` |
| 8 | + - `AWS_SECRET_ACCESS_KEY` |
| 9 | + |
| 10 | +See [AWS Provider docs](https://www.terraform.io/docs/providers/aws/index.html#configuration-reference) for more details about these variables |
| 11 | +and alternatives, like `AWS_PROFILE`. |
| 12 | + |
| 13 | +Additionally, a publicly accesible DNS domain registered as a Route53 managed zone is required. |
| 14 | +The name of the domain should be passed to terraform via the `base_domain` input variable. |
| 15 | + |
| 16 | +Example: |
| 17 | + |
| 18 | +```export TF_VAR_base_domain=k8s.myself.com``` |
| 19 | +## Versions |
| 20 | + |
| 21 | +You can set the desired version of Kubernetes by editing the `main.tf` configuration file and replacing the version in the source URL of the `typhoon-acc` module. |
| 22 | + |
| 23 | +Example: |
| 24 | +``` |
| 25 | +
|
| 26 | +module "typhoon-acc" { |
| 27 | + source = "git::https://github.com/poseidon/typhoon//aws/fedora-coreos/kubernetes?ref=v1.18.0" # set the desired Kubernetes version here |
| 28 | +... |
| 29 | +``` |
| 30 | +## Worker node count and instance type |
| 31 | + |
| 32 | +You can control the amount of worker nodes in the cluster as well as their machine type, using the following variables: |
| 33 | + |
| 34 | + - `TF_VAR_controller_count` |
| 35 | + - `TF_VAR_controller_type` |
| 36 | + - `TF_VAR_workers_count` |
| 37 | + - `TF_VAR_workers_type` |
| 38 | + |
| 39 | +Export values for them or pass them to the apply command line. |
| 40 | + |
| 41 | +## Build the cluster |
| 42 | + |
| 43 | +``` |
| 44 | +terraform init |
| 45 | +terraform apply -var=cluster_name=typhoon |
| 46 | +``` |
| 47 | + |
| 48 | +## Exporting K8S variables |
| 49 | +To access the cluster you need to export the `KUBECONFIG` variable pointing to the `kubeconfig` file for the current cluster. |
| 50 | +``` |
| 51 | +export KUBECONFIG="$(terraform output kubeconfig_path)" |
| 52 | +``` |
| 53 | + |
| 54 | +Now you can access the cluster via `kubectl` and you can run acceptance tests against it. |
| 55 | + |
| 56 | +To run acceptance tests, your the following command in the root of the repository. |
| 57 | +``` |
| 58 | +TESTARGS="-run '^TestAcc'" make testacc |
| 59 | +``` |
| 60 | + |
| 61 | +To run only a specific set of tests, you can replace `^TestAcc` with any regular expression to filter tests by name. |
| 62 | +For example, to run tests for Pod resources, you can do: |
| 63 | +``` |
| 64 | +TESTARGS="-run '^TestAccKubernetesPod_'" make testacc |
| 65 | +``` |
0 commit comments