Crossplane Stack for Microsoft Azure 是一个基于 Crossplane 的扩展组件(Stack),旨在通过 Kubernetes API 统一管理 Microsoft Azure 云资源。作为 Crossplane 生态的一部分,该 Stack 提供了与 Azure 云服务的深度集成,允许用户以声明式方式定义、部署和管理 Azure 基础设施资源(如虚拟机、存储账户、网络组件等),实现基础设施即代码(IaC)与 Kubernetes 控制平面的无缝协同。
kubectl、Kubernetes API 或客户端工具(如 Terraform、ArgoCD)进行操作。tenantID、clientID、clientSecret、subscriptionID)。Azure Stack 通过 Crossplane Provider 实现与 Azure API 的交互,需先部署 Provider CRD 和控制器:
bash# 部署 Azure Provider CRD kubectl apply -f [***] kubectl apply -f [***] # 其他 CRDs(根据版本调整) # 部署 Provider 控制器(通过 Crossplane Package) kubectl apply -f - <<EOF apiVersion: pkg.crossplane.io/v1 kind: Provider metadata: name: provider-azure spec: package: xpkg.upbound.io/crossplane-contrib/provider-azure:v0.31.0 EOF
确认 Provider 状态为 HEALTHY:
bashkubectl get providers # 输出示例: # NAME INSTALLED HEALTHY PACKAGE AGE # provider-azure True True xpkg.upbound.io/crossplane-contrib/provider-azure:v0.31.0 5m
将 Azure Service Principal 信息存储为 Kubernetes Secret:
bashkubectl create secret generic azure-creds -n crossplane-system --from-literal=credentials='{ "tenantId": "your-azure-tenant-id", "clientId": "your-azure-client-id", "clientSecret": "your-azure-client-secret", "subscriptionId": "your-azure-subscription-id" }'
创建 ProviderConfig 以关联认证信息,供 Azure 资源管理使用:
yaml# azure-provider-config.yaml apiVersion: azure.crossplane.io/v1beta1 kind: ProviderConfig metadata: name: default spec: credentials: source: Secret secretRef: namespace: crossplane-system name: azure-creds key: credentials subscriptionID: "your-azure-subscription-id" # 可选,若 Secret 中已包含可省略
应用配置:
bashkubectl apply -f azure-provider-config.yaml
通过 Crossplane ManagedResource 定义 Azure 存储账户:
yaml# azure-storage-account.yaml apiVersion: storage.azure.crossplane.io/v1alpha1 kind: Account metadata: name: example-storage spec: forProvider: accountTier: Standard accountReplicationType: LRS location: eastus providerConfigRef: name: default # 关联上文定义的 ProviderConfig writeConnectionSecretToRef: name: storage-conn namespace: default
部署资源:
bashkubectl apply -f azure-storage-account.yaml
检查存储账户是否创建成功:
bashkubectl get accounts.storage.azure.crossplane.io example-storage # 输出示例(状态为 READY 表示成功): # NAME READY SYNCED EXTERNAL-NAME AGE # example-storage True True example-storage 3m
通过 合成资源(Composite Resources) 和 资源类(ResourceClass) 抽象通用 Azure 资源配置,实现标准化复用。例如,定义一个“开发环境存储账户”资源类:
yaml# storage-resource-class.yaml apiVersion: core.crossplane.io/v1alpha1 kind: ResourceClass metadata: name: azure-storage-dev spec: provisioner: account.storage.azure.crossplane.io/v1alpha1 parameters: accountTier: Standard accountReplicationType: LRS location: eastus providerConfigRef: name: default
Azure Stack 相关镜像(Provider 控制器)托管于 Upbound Registry:
bashdocker pull xpkg.upbound.io/crossplane-contrib/provider-azure:v0.31.0
Provider 控制器部署 YAML(由 Crossplane 自动管理,通常无需手动修改):
yamlapiVersion: apps/v1 kind: Deployment metadata: name: crossplane-contrib-provider-azure namespace: crossplane-system spec: replicas: 1 selector: matchLabels: pkg.crossplane.io/provider: provider-azure template: metadata: labels: pkg.crossplane.io/provider: provider-azure spec: containers: - name: provider image: xpkg.upbound.io/crossplane-contrib/provider-azure:v0.31.0 args: - --debug resources: limits: cpu: 1000m memory: 1Gi requests: cpu: 100m memory: 20Mi
| 参数路径 | 描述 | 示例值 | 必需性 |
|---|---|---|---|
spec.credentials.secretRef.name | 存储 Azure 认证信息的 Secret 名称 | azure-creds | 是 |
spec.credentials.secretRef.key | Secret 中认证信息的 Key | credentials | 是 |
spec.subscriptionID | Azure 订阅 ID | xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | 是 |
spec.forProvider.location | Azure 资源部署区域 | eastus | 是 |
spec.forProvider.accountTier | 存储账户层级(针对存储资源) | Standard | 是 |
Provider 资源事件:kubectl describe provider provider-azure。kubectl describe account example-storage 或 kubectl logs -n crossplane-system deployment/crossplane-contrib-provider-azure。tenantID/clientID/clientSecret 是否正确。

来自真实用户的反馈,见证轩辕镜像的优质服务
免费版仅支持 Docker Hub 加速,不承诺可用性和速度;专业版支持更多镜像源,保证可用性和稳定速度,提供优先客服响应。
免费版仅支持 docker.io;专业版支持 docker.io、gcr.io、ghcr.io、registry.k8s.io、nvcr.io、quay.io、mcr.microsoft.com、docker.elastic.co 等。
当返回 402 Payment Required 错误时,表示流量已耗尽,需要充值流量包以恢复服务。
通常由 Docker 版本过低导致,需要升级到 20.x 或更高版本以支持 V2 协议。
先检查 Docker 版本,版本过低则升级;版本正常则验证镜像信息是否正确。
使用 docker tag 命令为镜像打上新标签,去掉域名前缀,使镜像名称更简洁。
探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
在 Linux 系统配置镜像加速服务
在 Docker Desktop 配置镜像加速
Docker Compose 项目配置加速
Kubernetes 集群配置 Containerd
在宝塔面板一键配置镜像加速
Synology 群晖 NAS 配置加速
飞牛 fnOS 系统配置镜像加速
极空间 NAS 系统配置加速服务
爱快 iKuai 路由系统配置加速
绿联 NAS 系统配置镜像加速
QNAP 威联通 NAS 配置加速
Podman 容器引擎配置加速
HPC 科学计算容器配置加速
ghcr、Quay、nvcr 等镜像仓库
无需登录使用专属域名加速
需要其他帮助?请查看我们的 常见问题 或 官方QQ群: 13763429