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

备注

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

你可以向用户提供 Kubernetes 作为 marketplace 项。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 中心和全局 Azure 租户设置。Before you start, check your Azure Stack Hub and global Azure tenant settings. 收集 Azure Stack 中心所需的信息。Collect the required information about your Azure Stack Hub. 向你的租户添加所需的资源,并 Azure Stack 中心市场。Add necessary resources to your tenant and to Azure Stack Hub Marketplace. 群集依赖于 Ubuntu 服务器、自定义脚本和 Kubernetes 群集 marketplace 项 Azure Stack 中心市场。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 marketplace 项创建计划、产品/服务和订阅。Create a plan, an offer, and a subscription for the Kubernetes marketplace item. 你还可以使用现有计划和产品/服务。You can also use an existing plan and offer.

  1. 登录到管理员门户。Sign in to the administrator portal.

  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 中心的 Azure AD 租户。Set the Directory tenant to the Azure AD tenant for your Azure Stack Hub.

    e.在“新建 MySQL 数据库”边栏选项卡中,接受法律条款,然后单击“确定”。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 server 映像Add an Ubuntu server image

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

  1. 登录到管理员门户Sign in to the administrator portal.

  2. 选择 "所有服务",然后在 "管理" 类别下选择 " Marketplace 管理"。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:

    • 发布者:规范Publisher: 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 中心市场添加 Kubernetes:Add the Kubernetes from Azure Stack Hub Marketplace:

  1. 打开管理员门户Open the administrator portal.

  2. 选择 "所有服务",然后在 "管理" 类别下选择 " Marketplace 管理"。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.0 的自定义脚本Offer: 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 添加到 marketplaceAdd Kubernetes to the marketplace

  1. 打开管理员门户Open the administrator portal.

  2. 选择 "所有服务",然后在 "管理" 类别下选择 " Marketplace 管理"。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.

    备注

    Marketplace 项可能需要五分钟的时间才会出现在 Azure Stack Hub Marketplace 中。It may take five minutes for the marketplace item to appear in Azure Stack Hub Marketplace.

    Azure Stack 中心 Marketplace 中的 Kubernetes 项

更新或删除 KubernetesUpdate or remove the Kubernetes

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

删除 Kubernetes 项:To remove the Kubernetes item:

  1. 使用 PowerShell 作为操作员连接到 Azure Stack 集线器。Connect to Azure Stack Hub with PowerShell as an operator. 有关说明,请参阅使用 PowerShell 作为操作员连接到 Azure Stack 集线器For 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 中心Deploy a Kubernetes to Azure Stack Hub

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