在 Azure Stack Hub 中的 Windows 上安装 AKS 引擎Install the AKS engine on Windows in Azure Stack Hub

可以在 Azure Stack Hub 中使用 Windows 计算机托管 AKS 引擎,以便部署和管理 Kubernetes 群集。You can use a Windows machine in your Azure Stack Hub to host the AKS engine in order to deploy and manage a Kubernetes cluster. 在本文中,我们将介绍准备客户端 VM 以管理已连接和断开连接的 Azure Stack Hub 实例的群集、检查安装并在 ASDK 上设置客户端 VM。In this article, we look at preparing the client VM to manage your cluster for both connected and disconnected Azure Stack Hub instances, check the install, and setting up the client VM on the ASDK.

准备客户端 VMPrepare the client VM

AKS 引擎是一种命令行工具,用于部署和管理 Kubernetes 群集。The AKS engine is a command-line tool used to deploy and manage your Kubernetes cluster. 可以在 Azure Stack Hub 中的计算机上运行引擎。You can run the engine on a machine in your Azure Stack Hub. 从此计算机中,你将执行 AKS 引擎来部署运行群集所需的 IaaS 资源和软件。From this machine, you will execute the AKS engine to deploy the IaaS resources and software needed to run your cluster. 然后,可以使用运行引擎的计算机在群集上执行管理任务。You can then use the machine running the engine to perform management tasks on your cluster.

选择客户端计算机时,请考虑:When choosing your client machine, consider:

  1. 发生灾难时是否应恢复客户端计算机。If the client machine should be recoverable in case of a disaster.
  2. 如何连接到客户端计算机以及计算机将如何与群集交互。How you will connect to the client machine and how the machine will interact with your cluster.

安装在连接的环境中Install in a connected environment

可以安装客户端 VM 以在连接到 Internet 的 Azure Stack Hub 上管理 Kubernetes 群集。You can install the client VM to manage your Kubernetes cluster on an Azure Stack Hub connected to the Internet.

  1. 在 Azure Stack Hub 中创建 Windows VM。Create a Windows VM in your Azure Stack Hub. 有关说明,请参阅快速入门:使用 Azure Stack Hub 门户创建 Windows 服务器 VMFor instructions, see Quickstart: Create a Windows server VM by using the Azure Stack Hub portal.

  2. 连接到 VM。Connect to your VM.

  3. 使用 PowerShell 说明安装 ChocolateyInstall Chocolatey using the PowerShell instructions..

    根据 Chocolatey 网站:Chocolatey 是 Windows 的包管理器,类似于 apt-get 或 yum,但适用于 Windows。According to the Chocolatey website: Chocolatey is a package manager for Windows, like apt-get or yum but for Windows. 它设计为一个分散的框架,用于快速安装所需的应用程序和工具。It was designed to be a decentralized framework for quickly installing applications and tools that you need. 它建立在 NuGet 基础结构上,目前使用 PowerShell 作为将包从发行版传送到门、错误、计算机的重点。It is built on the NuGet infrastructure currently using PowerShell as its focus for delivering packages from the distros to your door, err, computer.

  4. 受支持的 Kubernetes 版本表中找到 AKS 引擎的版本。Find the version of AKS engine in the Supported Kubernetes Versions table. 必须在 Azure Stack Hub 市场中提供 AKS 基础引擎。The AKS Base Engine must be available in your Azure Stack Hub Marketplace. 运行该命令时,必须指定版本 --version v0.48.0When running the command, you must specify the version --version v0.48.0. 如果不指定版本,该命令将安装最新版本,这可能需要一个市场中不提供的 VHD 映像。If you don't specify the version, the command will install the latest version, which may need an VHD image that is not available in your marketplace.

  5. 从提升的提示符运行以下命令,并添加版本号:Run the following command from an elevated prompt and include the version number:

        choco install aks-engine --version 0.51.0 -y
    

备注

如果此安装方法失败,可以在断开连接的环境或者 Try GoFish(一个备用包管理器)中尝试这些步骤。If this method for installation fails, you can try the steps in the disconnected environment, or Try GoFish, an alternate package manager.

在已断开连接的环境中安装Install in a disconnected environment

可以安装客户端 VM 以在与 Internet 断开连接的 Azure Stack Hub 上管理 Kubernetes 群集。You can install the client VM to manage your Kubernetes cluster on an Azure Stack Hub disconnected from the Internet.

  1. 从可访问 Internet 的计算机,转到 GitHub Azure/aks-engine From a machine with access to the Internet, go to GitHub Azure/aks-engine. 下载 Windows 计算机的存档 (*.tar.gz),例如 aks-engine-v0.38.8-windows-amd64.tar.gzDownload an archive (*.tar.gz) for a Windows machine, for example, aks-engine-v0.38.8-windows-amd64.tar.gz.

  2. 在 Azure Stack Hub 实例中创建存储帐户,以便使用 AKS 引擎二进制文件上传存档文件 (*.tar.gz)。Create a storage account in your Azure Stack Hub instance to upload the archive file (*.tar.gz) with the AKS engine binary. 有关使用 Azure 存储资源管理器的说明,请参阅 Azure 存储资源管理器与 Azure Stack HubFor instructions on using the Azure Storage Explorer, see Azure Storage Explorer with Azure Stack Hub.

  3. 在 Azure Stack Hub 中创建 Windows VM。Create a Windows VM in your Azure Stack Hub. 有关说明,请参阅快速入门:使用 Azure Stack Hub 门户创建 Windows 服务器 VMFor instructions, see Quickstart: Create a Windows server VM by using the Azure Stack Hub portal

  4. 从上传存档文件 (*.tar.gz) 所在的 Azure Stack Hub 存储帐户 Blob URL,将文件下载到管理 VM。From the Azure Stack Hub storage account blob URL where you uploaded the archive file (*.tar.gz), download the file to your management VM. 从命令提示符将存档提取到你有权访问的目录。Extract the archive to a directory that you have access to from your command prompt.

  5. 连接到 VM。Connect to your VM.

  6. 使用 PowerShell 说明安装 ChocolateyInstall Chocolatey using the PowerShell instructions..

  7. 在提升的提示符下运行以下命令。Run the following command from an elevated prompt. 包括正确的版本号:Include the right version number:

        choco install aks-engine --version 0.51.0 -y
    

验证安装Verify the installation

设置客户端 VM 后,请检查是否安装了 AKS 引擎。Once your client VM is set up, check that you have installed the AKS engine.

  1. 连接到客户端 VM。Connect to your client VM.

  2. 运行以下命令:Run the following command:

    aks-engine version
    

如果无法验证是否在客户端 VM 上安装了 AKS 引擎,请参阅 AKS 引擎安装故障排查If you are unable to verify that you have installed the AKS engine on your client VM, see Troubleshoot AKS engine install

ASDK 安装ASDK installation

在 ASDK 外的计算机的 ASDK 上运行 AKS 引擎的客户端 VM 时,需要添加证书。You will need to add a certificate when running the client VM for the AKS engine on the ASDK on a machine outside of the ASDK. 如果你在 ASDK 环境中使用 Windows VM,则计算机已信任 ASDK 证书。If you're using a Windows VM within the ASDK environment itself, the machine already trusts the ASDK certificate. 如果客户端计算机在 ASDK 之外,则需要从 ASDK 中提取证书,并将其添加到 Windows 计算机。If your client machine is outside of the ASDK, you need to extract the certificate from the ASDK, and add it to the your Windows machine.

当你使用 ASDK 时,Azure 资源管理器终结点正在使用自签名证书,你需要显式将此证书添加到计算机的受信任证书存储。When you are using an ASDK your Azure Resource Manager endpoint is using a self-signed certificate, you need explicitly to add this certificate to the machine's trusted certificate store. 可以在 ASDK 中部署的任何 VM 中找到 ASDK 根证书。You can find the ASDK root certificate in any VM you deploy in the ASDK.

  1. 导出 CA 根证书。Export the CA root certificate. 有关说明,请参阅导出 Azure Stack Hub CA 根证书For instructions, see Export the Azure Stack Hub CA root certificate
  2. 信任 Azure Stack Hub CA 根证书。Trust the Azure Stack Hub CA root certificate. 有关说明,请参阅信任 Azure Stack Hub CA 根证书For instructions, see Trust the Azure Stack Hub CA root certificate.

后续步骤Next steps