Build clusterctl
and clusterawsadm
from the master branch of (cluster-api-provider-aws)[https://github.com/kubernetes-sigs/cluster-api-provider-aws]
make clusterctl clusterawsadm
Set 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-stack
Create the example manifests:
pushd cmd/clusterctl/examples/aws
./generate_yaml.sh
popd
This 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.yaml
kubectl create -f cmd/clusterctl/examples/aws/out/cluster.yaml
Currently 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.yaml
clusterctl alpha phases get-kubeconfig --kubeconfig=<path to management cluster kubeconfig> --provider=aws --cluster-name=test1
This 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=kubeconfig
Currently 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.yaml
To watch for the node to become available:
kubectl --kubeconfig=kubeconfig get nodes -w