Provision a Kubernetes cluster with Terraform on AWS.
Inspired by kubestack
Hot off the presses... Still in development.
Terraform will be used to declare and provision a Kubernetes cluster.
Create a terraform.tfvars file in the top-level directory of the repo with content like:
ssh_key_name = name_of_my_key_pair_in_AWS access_key = my_AWS_access_key secret_key = my_AWS_secret_key This file is ignored by git. You can also set these by using environment variables.
You also need to make sure you are running ssh-agent and have your AWS key added.
This repo includes a very simple Makefile that will handle generating an etcd discovery token.
To create the cluster, run make apply
To destroy the cluster, run make destroy
You can override any variables listed in variables.tf such as the ami to use, number of nodes, etc
When you create a cluster, it will output something like:
Outputs: kubernetes-api-server = http://<IP>:8080 You can use this to configure kubectl:
kubectl config set-cluster aws-test --insecure-skip-tls-verify=true --server=$kubernetes-api-server kubectl config use-context aws-test where $kubernetes-api-server is the url from the output.
Test this by running kubectl get nodes
Yuou should now be able to use kubectl to create services. See the kubernetes examples to get started.