How to create a Kubernetes cluster for Testground
Last updated
Last updated
Testground is not coupled with AWS, but the infrastructure playbooks described in this section are targeted at AWS.
First and foremost, you need an AWS account with API access.
Next, download and install all required software:
>= 1.17.0
>= 0.12.21
>= 3.0
.
.
kops
It is used for the Kubernetes master and worker nodes
kops
stateThis is similar to Terraform state bucket.
Where:
<bucket_name>
is an AWS account-wide unique bucket name to store this cluster's kops
state, e.g. kops-backend-bucket-<your_username>
.
<region>
is an AWS region like eu-central-1
or us-west-2
.
a cluster name (for example name.k8s.local
)
set AWS region
set AWS availability zone A (not region; for example us-west-2a
[availability zone]) - used for master node and worker nodes
set AWS availability zone B (not region; for example us-west-2b
[availability zone]) - used for more worker nodes
set kops
state store bucket (the bucket we created in the section above)
set number of worker nodes
set worker node instance type
set location of your cluster SSH public key (for example ~/.ssh/testground_rsa.pub
generated above)
set team and project name - these values are used as tags in AWS for cost allocation purposes
You might want to add them to your rc
file (.zshrc
, .bashrc
, etc.), or to an .env.sh
file that you source.
Create a .env.toml
file in your $TESTGROUND_HOME
and add your AWS region to the ["aws"]
section, as well as the correct endpoint. The endpoint refers to the testground-daemon
service, so depending on your setup, this could be, for example, a Load Balancer fronting the kubernetes cluster and forwarding proper requests to the tg-daemon
service, or a simple port forward to your local workstation:
This will take about 10-15 minutes to complete.
Once you run this command, take some time to walk the dog, clean up around the office, or go get yourself some coffee! When you return, your shiny new Kubernetes cluster will be ready to run Testground plans.
Do not forget to delete the cluster once you are done running test plans.
Edit the cluster state and change number of nodes.
Apply the new configuration
Wait for nodes to come up and for DaemonSets
to be Running
on all new nodes
kops
lets you download the entire Kubernetes context config.
If you want to let other people on your team connect to your Kubernetes cluster, you need to give them the information.
set master node instance type (read on best practices at )