A CloudFormation script to create a 1 Node Kubernetes Cluster based on Sander Van Vugt Method.
-
Install and configure AWS CLI
-
Set correct region for AWS CLI
export AWS_REGION="us-east-1" export AWS_DEFAULT_REGION="us-east1"
$ aws cloudformation create-stack --capabilities CAPABILITY_AUTO_EXPAND CAPABILITY_NAMED_IAM --template-body file://my.yml --stack-name KubernetesMaster --parameters ParameterKey=KeyName,ParameterValue=<key_name>
-
Obtain SSH command to connect to Master:
$ aws cloudformation describe-stacks --query "Stacks[*].Outputs[?OutputKey=='MasterSSH'].OutputValue" --output text
-
Login to master using the above SSH command
-
Run command:
$ sudo -s $ export KUBECONFIG=/etc/kubernetes/admin.conf $ kubeadm token create --print-join-command
-
Obtain SSH command to connect to Worker:
$ aws cloudformation describe-stacks --query "Stacks[*].Outputs[?OutputKey=='MasterSSH'].OutputValue" --output text
-
Login to master using the above SSH command
-
Run the following commands:
$ sudo -s $ kubeadm join... (obtained in Step#3)
If after kubeadm join, the nodes remain "NotReady', run the following command in Master:
# export KUBECONFIG=/etc/kubernetes/admin.conf
# kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"