An attempt to implement Kelsey Hightower's kubernetes-the-hard-way tutorial on AWS using Terraform and Ansible.
The following steps are required to setup and run this project:
- Clone the repo
- Generate an SSH key which can be used to SSH to the Kubernetes EC2 instances which will be created. The generated public/private key pair should be generated in a folder matching the path(s) found in the respective variables
PATH_TO_PRIVATE_KEY
andPATH_TO_PUBLIC_KEY
which are declared in the Terraform variables file. An example of generating such a public/private key pair is given below:
ssh-keygen -t rsa -b 4096 -C "kubernetes-the-hard-way" -f kubernetes_ec2_key
- Ensure that the AWS credentials profile that you wish to use to run this project is specified correctly in the
AWS_PROFILE
variable in the Terraform variables file. - Install Terraform.
- Install go.
- Install the following cfssl tools:
go get -u github.com/cloudflare/cfssl/cmd/cfssl
go get -u github.com/cloudflare/cfssl/cmd/cfssljson
go get -u github.com/cloudflare/cfssl/cmd/mkbundle
- From the terraform directory execute the following to ensure that the expected resources will be created:
terraform plan
and then to actually create the required AWS resources:
terraform apply
- Install Ansible:
pip install ansible
- Install boto
pip install boto
- From the ansible directory run
./infrastructure.sh
- Install kubectl
- From project root run:
./configure-kubectl.sh [URL OF LOADBALANCER]
where URL OF LOADBALANCER should be the URL of the load balancer created as part of the cluster setup.