Getting started with cluster-api-provider-azure
Prerequisites
Requirements
- A Microsoft Azure account
- Note: If using a new subscription, make sure to register the following resource providers:
Microsoft.Compute
Microsoft.Network
Microsoft.ContainerService
Microsoft.ManagedIdentity
Microsoft.Authorization
Microsoft.ResourceHealth
(if theEXP_AKS_RESOURCE_HEALTH
feature flag is enabled)
- Note: If using a new subscription, make sure to register the following resource providers:
- Install the Azure CLI
- A supported version of
clusterctl
Setting up your Azure environment
An Azure Service Principal is needed for deploying Azure resources. The below instructions utilize environment-based authentication.
- Login with the Azure CLI.
az login
- List your Azure subscriptions.
az account list -o table
- If more than one account is present, select the account that you want to use.
az account set -s <SubscriptionId>
- Save your Subscription ID in an environment variable.
export AZURE_SUBSCRIPTION_ID="<SubscriptionId>"
- Create an Azure Service Principal by running the following command or skip this step and use a previously created Azure Service Principal. NOTE: the "owner" role is required to be able to create role assignments for system-assigned managed identity.
az ad sp create-for-rbac --role contributor --scopes="/subscriptions/${AZURE_SUBSCRIPTION_ID}"
- Save the output from the above command somewhere easily accessible and secure. You will need to save the
tenantID
,clientID
, andclient secret
. When creating a Cluster, you will need to provide these values as a part of theAzureClusterIdentity
object. Note that authentication via environment variables is now removed and anAzureClusterIdentity
is required to be created. An exampleAzureClusterIdentity
object is shown below:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AzureClusterIdentity
metadata:
labels:
clusterctl.cluster.x-k8s.io/move-hierarchy: "true"
name: <cluster-identity-name>
namespace: default
spec:
allowedNamespaces: {}
clientID: <clientID>
clientSecret:
name: <client-secret-name>
namespace: <client-secret-namespace>
tenantID: <tenantID>
type: ServicePrincipal
Building your first cluster
Check out the Cluster API Quick Start to create your first Kubernetes cluster on Azure using Cluster API. Make sure to select the "Azure" tabs.
If you are looking to install additional ASO CRDs, set ADDITIONAL_ASO_CRDS
to the list of CRDs you want to install. Refer to adding additional CRDs for Azure Service Operator here.
Warning
Not all versions of clusterctl are supported. Please see which versions are currently supported
Documentation
Please see the CAPZ book for in-depth user documentation.