Build clusterctl and clusterawsadm from the master branch of (cluster-api-provider-aws)[https://github.com/kubernetes-sigs/cluster-api-provider-aws]
make clusterctl clusterawsadmSet AWS environment variables:
export AWS_REGION=us-east-1
export AWS_ACCESS_KEY_ID=<your aws access key id>
export AWS_SECRET_ACCESS_KEY=<your aws secret access key>Deploy the CloudFormation Stack for the AWS pre-requisites:
clusterawsadm alpha bootstrap create-stackCreate the example manifests:
pushd cmd/clusterctl/examples/aws
./generate_yaml.sh
popdThis will create a subdirectory named out with four files:
- addons.yaml (default addons to apply to created clusters, currently only deploys the Calico CNI provider components)
- cluster.yaml (A Cluster definition for a Cluster named test1)
- machines.yaml (A MachineList definition containing one control plane node and one worker node)
- provider-components.yaml (Definitions for the necessary components for running cluster-api and cluster-api-provider-aws, this also includes a Secret generated from the AWS environment variables that were set earlier)
kubectl create -f cmd/clusterctl/examples/aws/out/provider-components.yamlkubectl create -f cmd/clusterctl/examples/aws/out/cluster.yamlCurrently clusterctl does not provide a way to extract just the control plane machine from the MachineList in machines.yaml when running individual phases, so this step will need to be done manually.
This assumes that a new file controlplane.yaml was created with just the control plane node object defined in machines.yaml
kubectl create -f cmd/clusterctl/examples/aws/out/controlplane.yamlclusterctl alpha phases get-kubeconfig --kubeconfig=<path to management cluster kubeconfig> --provider=aws --cluster-name=test1This command will write a file named kubeconfig to the current working directory.
While it would be possible to run this command directly with kubectl, clusterctl is used here since the control plane may not yet be up for the cluster and clusterctl will continue to retry until the control plane becomes available.
clusterctl alpha phases apply-addons -a cmd/clusterctl/examples/aws/out/controlplane.yaml --kubeconfig=kubeconfigCurrently clusterctl does not provide a way to extract just the worker machine from the MachineList in machines.yaml when running individual phases, so this step will need to be done manually.
This assumes that a new file worker.yaml was created with just the worker node object defined in machines.yaml
kubectl create -f cmd/clusterctl/examples/aws/out/worker.yamlTo watch for the node to become available:
kubectl --kubeconfig=kubeconfig get nodes -w