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)。4.2.1 安装 Azure Provider
Azure Stack 通过 Crossplane Provider 实现与 Azure API 的交互,需先部署 Provider CRD 和控制器:
bash# 部署 Azure Provider CRD kubectl apply -f https://raw.githubusercontent.com/crossplane-contrib/provider-azure/v0.31.0/package/crds/core.crossplane.io_providerconfigs.yaml kubectl apply -f https://raw.githubusercontent.com/crossplane-contrib/provider-azure/v0.31.0/package/crds/... # 其他 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
4.2.2 验证 Provider 部署
确认 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
4.3.1 创建 Azure 认证 Secret
将 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" }'
4.3.2 定义 ProviderConfig
创建 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
4.4.1 示例:创建 Azure 存储账户
通过 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
4.4.2 验证资源状态
检查存储账户是否创建成功:
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 登录认证访问私有仓库
无需登录使用专属域名
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
Harbor Proxy Repository 对接专属域名
Portainer Registries 加速拉取
Nexus3 Docker Proxy 内网缓存
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
docker search 限制
站内搜不到镜像
离线 save/load
插件要用 plugin install
WSL 拉取慢
安全与 digest
新手拉取配置
镜像合规机制
manifest unknown
no matching manifest(架构)
invalid tar header(解压)
TLS 证书失败
DNS 超时
域名连通性排查
410 Gone 排查
402 与流量用尽
401 认证失败
429 限流
D-Bus 凭证提示
413 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务