This repository contains a sample project for demonstrating how to use Crossplane with Azure to deploy some Azure resources. Crossplane is an open-source Kubernetes add-on that enables platform teams to assemble infrastructure from various cloud providers, like Azure, AWS, or GCP, using Kubernetes-style API resources.
In this demo, I will walk you through the process of setting up Crossplane with Azure, configuring the Azure Provider, creating a Composition and deploying it along side with a Composite Resource Definition (XRD) and requesting Azure resources via a Claim.
Before starting, ensure you have the following installed:
- Kubernetes cluster (with kubectl configured)
- Azure CLI installed
- Access to an Azure tenant and a subscription
- Install Crossplane (via Helm):
helm repo add crossplane-stable https://charts.crossplane.io/stable
helm repo update
helm install crossplane \
crossplane-stable/crossplane \
--namespace crossplane-system \
--create-namespace
- Log in to the Azure CLI:
az login
Create a service principal with access to an Azure subscription and save the resulting credentials:
az ad sp create-for-rbac \
--sdk-auth \
--role Owner \
--scopes /subscriptions/PLACE_YOUR_SUBSCRIPTION_ID_HERE > ./creds.json
- Create a Kubernetes secret from the Service Principale credentials, for your Providers to use as the authentication method against Azure:
kubectl create secret \
generic azure-provider-credentials \
-n crossplane-system \
--from-file=credentials=./creds.json
- Apply the preconfigured ProviderConfig from
configuration/providerconfig.yaml
kubectl apply -f ./configuration/providerconfig.yaml
- Install the Azure Providers:
kubectl apply -f ./configuration/provider.yaml
- Install the Composite Resource Definition (XRD) and Composition:
kubectl apply -f ./apis/definition.yaml
kubectl apply -f ./apis/composition.yaml
- Deploy a claim in a seperate namespace:
kubectl create namespace meetup
kubectl apply -f ./claim/meetup.yaml
- Extend the Composition and XRD to also deploy and Virtual Network + Subnet and have fun :)