In this tutorial we will show how to launch a Kubernetes cluster on AWS using CloudFormation and connect it to Weave Cloud.
Launch Stack on AWS
Click here to launch a Kubernetes cluster in AWS:
You will need to specify SSH key name to use for this, you must ensure this key is present in EC2 and
KeyName.pem is present on your workstation.
Once the CloudFormation stack has been created, look at the ‘Outputs’ section. Copy
GetKubeconfigCommand, paste it into your shell, and make sure to update the path to
KeyName.pem before you run it, e.g:
> scp -i ~/.ssh/ec2_weaveworks.eu-west-2.pem firstname.lastname@example.org:.kube/config ./kubeconfig The authenticity of host '18.104.22.168 (22.214.171.124)' can't be established. ECDSA key fingerprint is SHA256:SSdnwCtit5RrKyBDk2L8p+2u45Af6MJVOXUBJql2cVY. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '126.96.36.199' (ECDSA) to the list of known hosts. config 100% 5452 563.0KB/s 00:00
If you don’t have
kubectl installed on your workstation, you should install it now. Please refer to Installing and Setting Up
kubectl for details.
Next, check that the cluster has 4 nodes:
> kubectl --kubeconfig kubeconfig get nodes NAME STATUS AGE VERSION ip-172-31-0-114 Ready 40m v1.6.2 ip-172-31-0-139 Ready 40m v1.6.2 ip-172-31-0-150 Ready 40m v1.6.2 ip-172-31-0-195 Ready 40m v1.6.2
To avoid having to type
kubectl --kubeconfig kubeconfig, set the
KUBECONFIG environment variable:
Install Weave Cloud agents
> kubectl apply -f "https://cloud.weave.works/k8s/v1.6/weave-cloud?t=[cloud-token]" serviceaccount "weave-flux" created deployment "weave-flux-agent" created clusterrole "weave-flux" created clusterrolebinding "weave-flux" created serviceaccount "weave-scope" created daemonset "weave-scope-agent" created clusterrole "weave-scope" created clusterrolebinding "weave-scope" created serviceaccount "weave-cortex" created deployment "weave-cortex-agent" created configmap "weave-cortex-agent-config" created service "weave-cortex-agent" created daemonset "weave-cortex-node-exporter" created clusterrole "weave-cortex" created clusterrolebinding "weave-cortex" created