将 Kubernetes 添加到 Azure Stack Hub 市场Add Kubernetes to Azure Stack Hub Marketplace

备注

仅使用 Kubernetes Azure Stack Hub 市场项部署群集作为概念证明。Only use the Kubernetes Azure Stack Hub Marketplace item to deploy clusters as a proof-of-concept. 有关 Azure Stack Hub 上支持的 Kubernetes 群集,请使用 AKS 引擎For supported Kubernetes clusters on Azure Stack Hub, use the AKS engine.

可以将 Kubernetes 作为市场项提供给用户。You can offer Kubernetes as a marketplace item to your users. 然后,用户可以通过单个协调的操作部署 Kubernetes。Your users can then deploy Kubernetes in a single, coordinated operation.

本文着眼于使用 Azure 资源管理器模板为独立的 Kubernetes 群集部署和预配资源。This article looks at using an Azure Resource Manager template to deploy and provision the resources for a standalone Kubernetes cluster. 在开始之前,请检查 Azure Stack Hub 和全球 Azure 租户设置。Before you start, check your Azure Stack Hub and global Azure tenant settings. 收集关于 Azure Stack Hub 的必需信息。Collect the required information about your Azure Stack Hub. 将所需资源添加到租户和 Azure Stack Hub 市场。Add necessary resources to your tenant and to Azure Stack Hub Marketplace. 群集依赖于 Ubuntu 服务器、自定义脚本以及要发布到 Azure Stack Hub 市场中的 Kubernetes 群集市场项。The cluster depends on an Ubuntu server, custom script, and the Kubernetes Cluster marketplace item to be in Azure Stack Hub Marketplace.

创建计划、套餐和订阅Create a plan, an offer, and a subscription

为 Kubernetes 市场项创建计划、套餐和订阅。Create a plan, an offer, and a subscription for the Kubernetes marketplace item. 也可以使用现有计划和套餐。You can also use an existing plan and offer.

  1. 登录到管理员门户 https://adminportal.local.azurestack.externalSign in to the administrator portal https://adminportal.local.azurestack.external.

  2. 创建一个计划作为基本计划。Create a plan as the base plan. 有关说明,请参阅在 Azure Stack Hub 中创建计划For instructions, see Create a plan in Azure Stack Hub.

  3. 创建套餐。Create an offer. 有关说明,请参阅在 Azure Stack Hub 中创建套餐For instructions, see Create an offer in Azure Stack Hub.

  4. 选择“套餐”,并找到你创建的套餐。Select Offers, and find the offer you created.

  5. 选择“套餐”边栏选项卡中的“概述”。Select Overview in the Offer blade.

  6. 选择“更改状态”。Select Change state. 选择“公共”。Select Public.

  7. 选择“+ 创建资源” > “套餐和计划” > “订阅”来创建订阅 。Select + Create a resource > Offers and Plans > Subscription to create a subscription.

    a.a. 输入显示名称Enter a Display Name.

    b.b. 输入用户Enter a User. 请使用与你的租户关联的 Azure AD 帐户。Use the Azure AD account associated with your tenant.

    c.c. 提供商说明Provider Description

    d.d. 将“目录租户”设置为你的 Azure Stack Hub 的 Azure AD 租户。Set the Directory tenant to the Azure AD tenant for your Azure Stack Hub.

    e.e. 选择“套餐”。Select Offer. 选择你创建的套餐的名称。Select the name of the offer that you created. 记下订阅 ID。Make note of the Subscription ID.

在 AD FS 中创建服务主体和凭据Create a service principal and credentials in AD FS

如果将 Active Directory 联合身份验证服务 (AD FS) 用于标识管理服务,则需要为部署 Kubernetes 群集的用户创建服务主体。If you use Active Directory Federated Services (AD FS) for your identity management service, you need to create a service principal for users deploying a Kubernetes cluster. 使用客户端机密创建服务主体。Create service principal using a client secret. 有关说明,请参阅使用客户端机密创建服务主体For instructions, see Create a service principal using a client secret.

添加 Ubuntu 服务器映像Add an Ubuntu server image

将以下 Ubuntu 服务器映像添加到 Azure Stack Hub 市场:Add the following Ubuntu Server image to Azure Stack Hub Marketplace:

  1. 登录到管理员门户 https://adminportal.local.azurestack.externalSign in to the administrator portal https://adminportal.local.azurestack.external.

  2. 选择“所有服务”,然后在“管理”类别下,选择“市场管理”。Select All services, and then under the ADMINISTRATION category, select Marketplace management.

  3. 选择“+ 从 Azure 添加”。Select + Add from Azure.

  4. 输入 Ubuntu ServerEnter Ubuntu Server.

  5. 选择最新版本的服务器。Select the newest version of the server. 检查完整版本并确保已安装最新版本:Check the full version and ensure that you have the newest version:

    • 发布者:CanonicalPublisher: Canonical
    • 产品/服务:UbuntuServerOffer: UbuntuServer
    • 版本:16.04.201806120(或最新版本)Version: 16.04.201806120 (or latest version)
    • SKU:16.04-LTSSKU: 16.04-LTS
  6. 选择“下载”。Select Download.

添加适用于 Linux 的自定义脚本Add a custom script for Linux

从 Azure Stack Hub 市场添加 Kubernetes:Add the Kubernetes from Azure Stack Hub Marketplace:

  1. 打开管理员门户 https://adminportal.local.azurestack.externalOpen the administrator portal https://adminportal.local.azurestack.external.

  2. 选择“所有服务”,然后在“管理”类别下,选择“市场管理”。Select ALL services and then under the ADMINISTRATION category, select Marketplace Management.

  3. 选择“+ 从 Azure 添加”。Select + Add from Azure.

  4. 输入 Custom Script for LinuxEnter Custom Script for Linux.

  5. 选择具有以下配置文件的服务器:Select the script with the following profile:

    • 产品/服务:适用于 Linux 的自定义脚本 2.0Offer: Custom Script for Linux 2.0

    • 版本:2.0.6(或最新版本)Version: 2.0.6 (or latest version)

    • 发布者:Microsoft CorpPublisher: Microsoft Corp

      备注

      可能会列出适用于 Linux 的自定义脚本的多个版本。More than one version of Custom Script for Linux may be listed. 你需要添加该项的最新版本。You need to add the last version of the item.

  6. 选择“下载”。Select Download.

将 Kubernetes 添加到市场Add Kubernetes to the marketplace

  1. 打开管理员门户 https://adminportal.local.azurestack.externalOpen the administrator portal https://adminportal.local.azurestack.external.

  2. 选择“所有服务”,然后在“管理”类别下,选择“市场管理”。Select All services and then under the ADMINISTRATION category, select Marketplace Management.

  3. 选择“+ 从 Azure 添加”。Select + Add from Azure.

  4. 输入 KubernetesEnter Kubernetes.

  5. 选择 Kubernetes ClusterSelect Kubernetes Cluster.

  6. 选择“下载”。Select Download.

    备注

    可能需要等待五分钟,市场项才会显示在 Azure Stack Hub 市场中。It may take five minutes for the marketplace item to appear in Azure Stack Hub Marketplace.

    Azure Stack Hub 市场中的 Kubernetes 项

更新或删除 KubernetesUpdate or remove the Kubernetes

更新 Kubernetes 项时,将删除 Azure Stack Hub 市场中的上一项。When updating the Kubernetes item, you remove the previous item in Azure Stack Hub Marketplace. 按照下面的说明将 Kubernetes 更新添加到 Azure Stack Hub 市场。Follow the instruction below to add the Kubernetes update to Azure Stack Hub Marketplace.

若要删除 Kubernetes 项,请执行以下操作:To remove the Kubernetes item:

  1. 以操作员身份使用 PowerShell 连接到 Azure Stack Hub。Connect to Azure Stack Hub with PowerShell as an operator. 有关说明,请参阅以操作员身份使用 PowerShell 连接到 Azure Stack HubFor instruction, see Connect to Azure Stack Hub with PowerShell as an operator.

  2. 在库中查找当前的 Kubernetes 群集项。Find the current Kubernetes Cluster item in the gallery.

    Get-AzsGalleryItem | Select Name
    
  3. 记下当前项的名称,例如 Microsoft.AzureStackKubernetesCluster.0.3.0Note name of the current item, such as Microsoft.AzureStackKubernetesCluster.0.3.0.

  4. 使用以下 PowerShell cmdlet 删除项:Use the following PowerShell cmdlet to remove the item:

    $Itemname="Microsoft.AzureStackKubernetesCluster.0.3.0"
    
    Remove-AzsGalleryItem -Name $Itemname
    

后续步骤Next steps

将 Kubernetes 部署到 Azure Stack HubDeploy a Kubernetes to Azure Stack Hub

在 Azure Stack Hub 中提供服务概述Overview of offering services in Azure Stack Hub