将映像部署到 Azure Stack Hub 上的 Azure Kubernetes 服务群集

可以使用 Azure Stack Hub Azure 容器注册表来存储映像。 部署到同一环境中的 Azure Kubernetes 服务 (AKS) 群集时,可以使用这些映像。

将应用部署到群集

若要将示例应用部署到 AKS 群集,请参阅教程:为 Azure Kubernetes 服务 (AKS) 准备应用程序

注意

尚不支持在创建 Azure Kubernetes 服务群集时使用 -attach-acr 选项。 必须使用服务主体 (SPN) ID 和相应的机密,并在 Kubernetes 中使用相同的 ID 和机密。 有关详细信息,请参阅使用服务主体进行 Azure 容器注册表身份验证

注意事项

联机指导中要记住的注意事项如下:

  • 需要 SPN,并且必须授予 AcrPull 对订阅、资源组或容器注册表资源的访问权限。

  • 必须使用同一 SPN 在 Kubernetes 中创建机密:

    $userSPNID = "<SPN GUID>"
    $userSPNSecret = "<SPN Secret GUID>"
    
    kubectl create secret docker-registry <secret name> `
         --docker-server=<myregistry>.azsacr.<region>.<fqdn> `
         --docker-username=$userSPNID `
         --docker-password=$userSPNSecret
    
  • 更新 YAML 以在部署过程中引用机密:

    imagePullSecrets: `
       - name: <secret name>
    

后续步骤

详细了解 Azure Stack Hub 上的 Azure 容器注册表