Skip to content

Instantly share code, notes, and snippets.

@sayanchowdhury
Last active February 22, 2024 16:30
Show Gist options
  • Select an option

  • Save sayanchowdhury/5abc854619e4568dd8c23ac36c24cc7b to your computer and use it in GitHub Desktop.

Select an option

Save sayanchowdhury/5abc854619e4568dd8c23ac36c24cc7b to your computer and use it in GitHub Desktop.
setup CAPZ - systemd-sysext

CAPZ setup for flatcar-sysext

Environment Variables

Given below are the list of enviroment variables required:

export SUBSCRIPTION_ID="--"
export AZURE_CLIENT_ID="--"
export AZURE_TENANT_ID="--"
export AZURE_CLIENT_SECRET="--"
export AZURE_SUBSCRIPTION_ID=$(az account show -s $SUBSCRIPTION_ID --query 'id' --output tsv)
export AZURE_SUBSCRIPTION_ID_B64="$(echo -n '$AZURE_SUBSCRIPTION_ID' | base64 | tr -d '\n')"
export AZURE_TENANT_ID_B64="$(echo -n '$AZURE_TENANT_ID' | base64 | tr -d '\n')"
export AZURE_CLIENT_ID_B64="$(echo -n '$AZURE_CLIENT_ID' | base64 | tr -d '\n')"
export AZURE_CLIENT_SECRET_B64="$(echo -n '$AZURE_CLIENT_SECRET' | base64 | tr -d '\n')"
export AZURE_LOCATION="westeurope"
export AZURE_CONTROL_PLANE_MACHINE_TYPE="Standard_D2s_v3"
export AZURE_NODE_MACHINE_TYPE="Standard_D2s_v3"
export FLATCAR_VERSION=3602.2.2
export AZURE_CLUSTER_IDENTITY_SECRET_NAME="cluster-identity-secret"
export CLUSTER_IDENTITY_NAME="cluster-identity"
export AZURE_CLUSTER_IDENTITY_SECRET_NAMESPACE="default"
export AZURE_SSH_PUBLIC_KEY="--"
export AZURE_SSH_PUBLIC_KEY_B64="$(echo -n "$AZURE_SSH_PUBLIC_KEY" | base64 | tr -d '\n')"
export EXP_CLUSTER_RESOURCE_SET=true
export EXP_MACHINE_POOL=true
export EXP_KUBEADM_BOOTSTRAP_FORMAT_IGNITION=true

Setup the Management & Workload Cluster

kind create cluster
kubectl create secret generic "${AZURE_CLUSTER_IDENTITY_SECRET_NAME}" --from-literal=clientSecret="${AZURE_CLIENT_SECRET}" --namespace "${AZURE_CLUSTER_IDENTITY_SECRET_NAMESPACE}"
clusterctl init --infrastructure azure
clusterctl generate cluster yudocaa-capz-flatcar-sysext \
   --from=file:///home/sayan/code/work/cluster-api-provider-azure/templates/cluster-template-flatcar-sysext.yaml \
   --kubernetes-version 1.27.8 --control-plane-machine-count=1 \
   --worker-machine-count=3 > yudocaa-capz-flatcar-sysext.yaml
kubectl apply -f yudocaa-capz-flatcar-sysext.yaml

Install CNI

clusterctl get kubeconfig ${CLUSTER_NAME} > ./${CLUSTER_NAME}.kubeconfig
kubectl --kubeconfig=./${CLUSTER_NAME}.kubeconfig apply -f https://docs.projectcalico.org/archive/v3.25/manifests/calico.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment