Files
rancher-docs/zh/pages-for-subheaders/use-windows-clusters.html
T

24 lines
58 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!doctype html>
<html lang="zh" dir="ltr" class="docs-wrapper docs-doc-page docs-version-current plugin-docs plugin-id-default docs-doc-id-pages-for-subheaders/use-windows-clusters">
<head>
<meta charset="UTF-8">
<meta name="generator" content="Docusaurus v2.2.0">
<title data-rh="true">在 Windows 集群上启动 Kubernetes | Rancher Manager</title><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:url" content="http://ranchermanager.docs.rancher.com/zh/pages-for-subheaders/use-windows-clusters"><meta data-rh="true" name="docusaurus_locale" content="zh"><meta data-rh="true" name="docsearch:language" content="zh"><meta data-rh="true" name="docusaurus_version" content="current"><meta data-rh="true" name="docusaurus_tag" content="docs-default-current"><meta data-rh="true" name="docsearch:version" content="current"><meta data-rh="true" name="docsearch:docusaurus_tag" content="docs-default-current"><meta data-rh="true" property="og:title" content="在 Windows 集群上启动 Kubernetes | Rancher Manager"><meta data-rh="true" name="description" content="使用 Rancher 配置自定义集群时,Rancher 通过 RKE(Rancher Kubernetes Engine)在现有节点上安装 Kubernetes。"><meta data-rh="true" property="og:description" content="使用 Rancher 配置自定义集群时,Rancher 通过 RKE(Rancher Kubernetes Engine)在现有节点上安装 Kubernetes。"><link data-rh="true" rel="icon" href="/zh/img/favicon.png"><link data-rh="true" rel="canonical" href="http://ranchermanager.docs.rancher.com/zh/pages-for-subheaders/use-windows-clusters"><link data-rh="true" rel="alternate" href="http://ranchermanager.docs.rancher.com/pages-for-subheaders/use-windows-clusters" hreflang="en"><link data-rh="true" rel="alternate" href="http://ranchermanager.docs.rancher.com/zh/pages-for-subheaders/use-windows-clusters" hreflang="zh"><link data-rh="true" rel="alternate" href="http://ranchermanager.docs.rancher.com/pages-for-subheaders/use-windows-clusters" hreflang="x-default"><link data-rh="true" rel="preconnect" href="https://30NEY6C9UY-dsn.algolia.net" crossorigin="anonymous"><link rel="search" type="application/opensearchdescription+xml" title="Rancher Manager" href="/zh/opensearch.xml">
<!-- Google Tag Manager -->
<script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-57KS2MW",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script>
<!-- End Google Tag Manager -->
<script src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js" charset="UTF-8" data-domain-script="0f98beb0-fc4c-417d-a42e-564e2cae42d2" async></script>
<script src="/scripts/optanonwrapper.js" async></script><link rel="stylesheet" href="/zh/assets/css/styles.19303192.css">
<link rel="preload" href="/zh/assets/js/runtime~main.ee5c32f6.js" as="script">
<link rel="preload" href="/zh/assets/js/main.bc269412.js" as="script">
</head>
<body class="navigation-with-keyboard">
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus">
<div role="region" aria-label="跳到主要内容"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">跳到主要内容</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/zh/"><div class="navbar__logo"><img src="/zh/img/rancher-logo-horiz-color.svg" alt="logo" class="themedImage_ToTc themedImage--light_HNdA"><img src="/zh/img/rancher-logo-horiz-color.svg" alt="logo" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate"></b></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link active" aria-haspopup="true" aria-expanded="false" role="button" href="/zh/">v2.7</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/zh/pages-for-subheaders/use-windows-clusters">v2.7</a></li><li><a class="dropdown__link" href="/zh/v2.6/pages-for-subheaders/use-windows-clusters">v2.6</a></li><li><a class="dropdown__link" href="/zh/v2.5/pages-for-subheaders/use-windows-clusters">v2.5</a></li><li><a class="dropdown__link" href="/zh/v2.0-v2.4/pages-for-subheaders/use-windows-clusters">v2.0-v2.4</a></li><li><a class="dropdown__link" href="/zh/versions">All versions</a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="navbar__item dropdown dropdown--hoverable dropdown--right"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link"><svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" class="iconLanguage_nlXk"><path fill="currentColor" d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path></svg>简体中文</a><ul class="dropdown__menu"><li><a href="/pages-for-subheaders/use-windows-clusters" target="_self" rel="noopener noreferrer" class="dropdown__link" lang="en">English</a></li><li><a href="/zh/pages-for-subheaders/use-windows-clusters" target="_self" rel="noopener noreferrer" class="dropdown__link dropdown__link--active" lang="zh">简体中文</a></li></ul></div><a href="https://github.com/rancher/rancher-docs" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link navbar__github">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://rancher.com" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Rancher Home<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="搜索"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">搜索</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="回到顶部" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/zh/">什么是 Rancher?</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/zh/getting-started/overview">开始使用</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/zh/pages-for-subheaders/new-user-guides">操作指南</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" tabindex="0" href="/zh/pages-for-subheaders/new-user-guides">新用户指南</a><button aria-label="打开/收起侧边栏菜单「新用户指南」" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-3 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/zh/pages-for-subheaders/authentication-permissions-and-global-configuration">身份验证、权限和全局配置</a><button aria-label="打开/收起侧边栏菜单「身份验证、权限和全局配置」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-3 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/zh/pages-for-subheaders/manage-clusters">管理集群</a><button aria-label="打开/收起侧边栏菜单「管理集群」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-3 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/zh/pages-for-subheaders/kubernetes-cluster-setup">Kubernetes 集群设置</a><button aria-label="打开/收起侧边栏菜单「Kubernetes 集群设置」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-3 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/zh/pages-for-subheaders/infrastructure-setup">基础设施设置</a><button aria-label="打开/收起侧边栏菜单「基础设施设置」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-3 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" tabindex="0" href="/zh/pages-for-subheaders/kubernetes-clusters-in-rancher-setup">Rancher 设置中的 Kubernetes 集群</a><button aria-label="打开/收起侧边栏菜单「Rancher 设置中的 Kubernetes 集群」" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-4 menu__list-item"><a class="menu__link" tabindex="0" href="/zh/how-to-guides/new-user-guides/kubernetes-clusters-in-rancher-setup/node-requirements-for-rancher-managed-clusters">Rancher 管理集群的节点要求</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-4 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/zh/pages-for-subheaders/checklist-for-production-ready-clusters">生产就绪集群检查清单</a><button aria-label="打开/收起侧边栏菜单「生产就绪集群检查清单」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-4 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/zh/pages-for-subheaders/set-up-clusters-from-hosted-kubernetes-providers">通过托管 Kubernetes 提供商设置集群</a><button aria-label="打开/收起侧边栏菜单「通过托管 Kubernetes 提供商设置集群」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-4 menu__list-item"><div class="menu__list-item-collapsible menu__list-item-collapsible--active"><a class="menu__link menu__link--sublist menu__link--active" aria-current="page" aria-expanded="true" tabindex="0" href="/zh/pages-for-subheaders/use-windows-clusters">使用 Windows 集群</a><button aria-label="打开/收起侧边栏菜单「使用 Windows 集群」" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-5 menu__list-item"><a class="menu__link" tabindex="0" href="/zh/how-to-guides/new-user-guides/kubernetes-clusters-in-rancher-setup/use-windows-clusters/azure-storageclass-configuration">Azure 中存储类的配置</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-5 menu__list-item"><a class="menu__link" tabindex="0" href="/zh/how-to-guides/new-user-guides/kubernetes-clusters-in-rancher-setup/use-windows-clusters/windows-linux-cluster-feature-parity">Windows 和 Linux 集群的功能奇偶一致性</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-5 menu__list-item"><a class="menu__link" tabindex="0" href="/zh/how-to-guides/new-user-guides/kubernetes-clusters-in-rancher-setup/use-windows-clusters/network-requirements-for-host-gateway">Host Gateway (L2bridge) 的网络要求</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-5 menu__list-item"><a class="menu__link" tabindex="0" href="/zh/how-to-guides/new-user-guides/kubernetes-clusters-in-rancher-setup/use-windows-clusters/workload-migration-guidance">将 Windows 工作负载从 RKE2 迁移到 RKE2</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-4 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/zh/pages-for-subheaders/set-up-cloud-providers">设置 Cloud Provider</a><button aria-label="打开/收起侧边栏菜单「设置 Cloud Provider」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-4 menu__list-item"><a class="menu__link" tabindex="0" href="/zh/how-to-guides/new-user-guides/kubernetes-clusters-in-rancher-setup/register-existing-clusters">注册现有集群</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-3 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/zh/pages-for-subheaders/launch-kubernetes-with-rancher">使用 Rancher 启动 Kubernetes</a><button aria-label="打开/收起侧边栏菜单「使用 Rancher 启动 Kubernetes」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-3 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/zh/pages-for-subheaders/kubernetes-resources-setup">Kubernetes 资源设置</a><button aria-label="打开/收起侧边栏菜单「Kubernetes 资源设置」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-3 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/zh/pages-for-subheaders/helm-charts-in-rancher">Rancher 中的 Helm Chart</a><button aria-label="打开/收起侧边栏菜单「Rancher 中的 Helm Chart」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-3 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/zh/pages-for-subheaders/deploy-apps-across-clusters">跨集群部署应用</a><button aria-label="打开/收起侧边栏菜单「跨集群部署应用」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-3 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/zh/pages-for-subheaders/backup-restore-and-disaster-recovery">备份、还原和灾难恢复</a><button aria-label="打开/收起侧边栏菜单「备份、还原和灾难恢复」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/zh/how-to-guides/new-user-guides/add-users-to-projects">添加项目成员</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/zh/how-to-guides/new-user-guides/manage-namespaces">命名空间</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/zh/pages-for-subheaders/advanced-user-guides">高级用户指南</a><button aria-label="打开/收起侧边栏菜单「高级用户指南」" type="button" class="clean-btn menu__caret"></button></div></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/zh/pages-for-subheaders/best-practices">参考指南</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/zh/pages-for-subheaders/cloud-marketplace">Rancher 中的集成</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/zh/faq/general-faq">常见问题</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/zh/troubleshooting/general-troubleshooting">故障排除</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/zh/contribute-to-rancher">参与 Rancher 社区贡献</a></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="页面路径"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="主页面" class="breadcrumbs__link" href="/zh/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">操作指南</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/zh/pages-for-subheaders/new-user-guides"><span itemprop="name">新用户指南</span></a><meta itemprop="position" content="2"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/zh/pages-for-subheaders/kubernetes-clusters-in-rancher-setup"><span itemprop="name">Rancher 设置中的 Kubernetes 集群</span></a><meta itemprop="position" content="3"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">使用 Windows 集群</span><meta itemprop="position" content="4"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">版本:v2.7</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">本页总览</button></div><div class="theme-doc-markdown markdown"><header><h1>在 Windows 集群上启动 Kubernetes</h1></header><p>使用 Rancher 配置<a href="/zh/pages-for-subheaders/use-existing-nodes">自定义集群</a>时,Rancher 通过 RKE(Rancher Kubernetes Engine)在现有节点上安装 Kubernetes。</p><p>在使用 Rancher 配置的 Windows 集群中,集群必须同时包含 Linux 和 Windows 节点。Kubernetes controlplane 只能运行在 Linux 节点上,Windows 节点只能有 Worker 角色。Windows 节点只能用于部署工作负载。</p><p>Windows 集群的其他要求如下:</p><ul><li>只有在创建集群时启用了 Windows 支持的集群才能添加 Windows 节点。无法为现有集群启用 Windows 支持。</li><li>需要 Kubernetes 1.15+。</li><li>必须使用 Flannel 网络提供商。</li><li>Windows 节点必须有 50 GB 的磁盘空间。</li></ul><p>有关完整的要求列表,请参阅<a href="#windows-%E9%9B%86%E7%BE%A4%E7%9A%84%E8%A6%81%E6%B1%82">本节</a>。</p><p>有关支持 Windows 的 Kubernetes 功能摘要,请参阅<a href="https://kubernetes.io/docs/setup/production-environment/windows/intro-windows-in-kubernetes/#supported-functionality-and-limitations" target="_blank" rel="noopener noreferrer">在 Windows 中使用 Kubernetes 支持的功能和限制</a>的 Kubernetes 文档,或<a href="https://kubernetes.io/docs/setup/production-environment/windows/user-guide-windows-containers/" target="_blank" rel="noopener noreferrer">在 Kubernetes 中调度 Windows 容器的指南</a>。</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="rancher-26-变更">Rancher 2.6 变更<a class="hash-link" href="#rancher-26-变更" title="标题的直接链接">​</a></h2><p>Rancher 2.6 支持直接使用 Rancher UI 配置 <a href="https://docs.rke2.io/" target="_blank" rel="noopener noreferrer">RKE2</a> 集群。RKE2,也称为 RKE Government,是一个完全符合标准的 Kubernetes 发行版,它专注于安全性和合规性。</p><p>在 Rancher 2.6.5 中,RKE2 已经 GA。</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="rke2-windows">RKE2 Windows<a class="hash-link" href="#rke2-windows" title="标题的直接链接">​</a></h3><p>RKE2 配置功能还包括在 Windows 集群上安装 RKE2。RKE2 的 Windows 功能包括:</p><ul><li>由 containerd 提供支持的使用 RKE2 的 Windows 容器</li><li>直接从 Rancher UI 配置 Windows RKE2 自定义集群</li><li>用于 Windows RKE2 自定义集群的 Calico CNI</li><li>技术预览包含了 Windows Server 的 SAC 版本(2004 和 20H2)</li></ul><p>要使 Windows 支持 RKE2 自定义集群,请选择 Calico 作为 CNI。</p><div class="theme-admonition theme-admonition-note alert alert--secondary admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></span>备注</div><div class="admonitionContent_S0QG"><p>默认情况下,Rancher 允许 Windows 工作负载 pod 部署在 Windows 和 Linux Worker 节点上。在 RKE2 中创建混合集群时,你必须编辑 Chart 中的 <code>nodeSelector</code>,从而将 Pod 放置到兼容的 Windows 节点上。有关如何使用 <code>nodeSelector</code> 将 pod 分配给节点的更多信息,请参阅 <a href="https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector" target="_blank" rel="noopener noreferrer">Kubernetes 文档</a>。</p></div></div><p><strong><em>Rancher v2.6.7 新功能</em></strong></p><ul><li>Kubernetes v1.24.1 及更高版本支持 Windows RKE2 中的 HostProcess 容器。有关详细信息,请参阅<a href="https://kubernetes.io/docs/tasks/configure-pod-container/create-hostprocess-pod/" target="_blank" rel="noopener noreferrer">上游文档</a>。</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="windows-集群的要求">Windows 集群的要求<a class="hash-link" href="#windows-集群的要求" title="标题的直接链接">​</a></h2><p>网络、操作系统和 Docker 的一般节点要求与 <a href="/zh/pages-for-subheaders/installation-requirements">Rancher 安装</a>的节点要求相同。</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="操作系统和-docker-要求">操作系统和 Docker 要求<a class="hash-link" href="#操作系统和-docker-要求" title="标题的直接链接">​</a></h3><p>我们对 Windows Server 和 Windows 容器的支持与 LTSC(长期服务渠道)和 SAC(半年渠道)的 Microsoft 官方生命周期相匹配。</p><p>有关 Windows Server 的支持生命周期的日期,请参阅 <a href="https://docs.microsoft.com/en-us/windows-server/get-started/windows-server-release-info" target="_blank" rel="noopener noreferrer">Microsoft 文档</a>。</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="kubernetes-版本">Kubernetes 版本<a class="hash-link" href="#kubernetes-版本" title="标题的直接链接">​</a></h3><p>需要 Kubernetes v1.15+。</p><p>如果你在 Windows Server 20H2 Standard Core 上使用 Kubernetes v1.21,则必须在节点上安装补丁“2019-08 Servicing Stack Update for Windows Server”。</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="节点要求">节点要求<a class="hash-link" href="#节点要求" title="标题的直接链接">​</a></h3><p>集群中的主机至少需要:</p><ul><li>2 核 CPU</li><li>5 GB 内存</li><li>50 GB 磁盘空间</li></ul><p>Rancher 不会配置不满足要求的节点。</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="网络要求">网络要求<a class="hash-link" href="#网络要求" title="标题的直接链接">​</a></h3><p>在配置新集群之前,请确保你已经在接收入站网络流量的设备上安装了 Rancher。这是集群节点与 Rancher 通信所必需的。如果你尚未安装 Rancher,请在继续阅读本指南之前先参阅<a href="/zh/pages-for-subheaders/installation-and-upgrade">安装文档</a>进行安装。</p><p>Rancher 仅支持使用 Flannel 作为网络提供商的 Windows。</p><p>有两个网络选项:<a href="https://github.com/coreos/flannel/blob/master/Documentation/backends.md#host-gw" target="_blank" rel="noopener noreferrer"><strong>Host Gateway (L2bridge)</strong></a> 和 <a href="https://github.com/coreos/flannel/blob/master/Documentation/backends.md#vxlan" target="_blank" rel="noopener noreferrer"><strong>VXLAN (Overlay)</strong></a>。默认选项是 <strong>VXLAN (Overlay)</strong> 模式。</p><p>对于 <strong>Host Gateway (L2bridge)</strong> 网络,最好为所有节点使用相同的第 2 层网络。否则,你需要为它们配置路由规则。有关详细信息,请参阅<a href="/zh/how-to-guides/new-user-guides/kubernetes-clusters-in-rancher-setup/use-windows-clusters/network-requirements-for-host-gateway#%E4%BA%91%E6%89%98%E7%AE%A1%E8%99%9A%E6%8B%9F%E6%9C%BA%E7%9A%84%E8%B7%AF%E7%94%B1%E9%85%8D%E7%BD%AE">配置云托管 VM 路由的文档</a>。如果你使用的是 Amazon EC2、Google GCE 或 Azure 虚拟机,你需要<a href="/zh/how-to-guides/new-user-guides/kubernetes-clusters-in-rancher-setup/use-windows-clusters/network-requirements-for-host-gateway#%E7%A6%81%E7%94%A8%E7%A7%81%E6%9C%89-ip-%E5%9C%B0%E5%9D%80%E6%A3%80%E6%9F%A5">禁用私有 IP 地址检查</a>。</p><p>对于 <strong>VXLAN (Overlay)</strong> 网络,你必须安装 <a href="https://support.microsoft.com/en-us/help/4489899" target="_blank" rel="noopener noreferrer">KB4489899</a> 修补程序。大多数云托管的 VM 已经具有此修补程序。</p><p>如果你在为 AWS 虚拟私有云配置 DHCP 选项集,请注意,你只能在 <code>domain-name</code> 选项字段中指定一个域名。详情请参见 <a href="https://docs.aws.amazon.com/vpc/latest/userguide/VPC_DHCP_Options.html" target="_blank" rel="noopener noreferrer">DHCP 选项文档</a>。</p><div class="theme-admonition theme-admonition-note alert alert--secondary admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></span>备注</div><div class="admonitionContent_S0QG"><p>一些 Linux 操作系统支持以空格分隔的多个域名。但是,其他 Linux 操作系统和 Windows 将该值视为单个域名,从而导致意外错误。如果你的 DHCP 选项集与具有多个操作系统实例的 VPC 相关联,请仅指定一个域名。</p></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="带有-esxi-67u2-及更高版本的-vsphere-上的-rancher">带有 ESXi 6.7u2 及更高版本的 vSphere 上的 Rancher<a class="hash-link" href="#带有-esxi-67u2-及更高版本的-vsphere-上的-rancher" title="标题的直接链接">​</a></h3><p>如果你在带有 ESXi 6.7u2 或更高版本的 VMware vSphere 上使用 Rancher,并使用 Red Hat Enterprise Linux 8.3、CentOS 8.3 或 SUSE Enterprise Linux 15 SP2 或更高版本,你需要禁用 <code>vmxnet3</code> 虚拟网络适配器硬件卸载功能。否则,不同集群节点上的 pod 之间的所有网络连接会因为超时错误而失败。从 Windows pod 到在 Linux 节点上运行的关键服务(例如 CoreDNS)的所有连接也将失败。外部连接也可能失败。出现这个问题的原因是 Linux 发行版在 <code>vmxnet3</code> 中启用了硬件卸载功能,而且 <code>vmxnet3</code> 硬件卸载功能中存在一个会丢弃客户覆盖流量的数据包的 bug。要解决此问题,必须禁用 <code>vmxnet3</code> 硬件卸载功能。此设置不会在重启后继续生效,因此需要在每次启动时禁用。推荐的做法是在 <code>/etc/systemd/system/disable_hw_offloading.service</code> 中创建一个 systemd 单元文件,这会在启动时禁用 <code>vmxnet3</code> 硬件卸载功能。禁用 <code>vmxnet3</code> 硬件卸载功能的示例 systemd 单元文件如下所示。注意,<code>&lt;VM network interface&gt;</code> 必须自定义为主机的 <code>vmxnet3</code> 网络接口,如 <code>ens192</code>:</p><div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#bfc7d5"><span class="token plain">[Unit]</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">Description=Disable vmxnet3 hardware offloading feature</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">[Service]</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">Type=oneshot</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">ExecStart=ethtool -K &lt;VM network interface&gt; tx-udp_tnl-segmentation off</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">ExecStart=ethtool -K &lt;VM network interface&gt; tx-udp_tnl-csum-segmentation off</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">StandardOutput=journal</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">[Install]</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">WantedBy=multi-user.target</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>然后在 systemd 单元文件上设置适当的权限:</p><div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#bfc7d5"><span class="token plain">chmod 0644 /etc/systemd/system/disable_hw_offloading.service</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>最后,启用 systemd 服务:</p><div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#bfc7d5"><span class="token plain">systemctl enable disable_hw_offloading.service</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="架构要求">架构要求<a class="hash-link" href="#架构要求" title="标题的直接链接">​</a></h3><p>Kubernetes 集群管理节点(<code>etcd</code> 和 <code>controlplane</code>)必须运行在 Linux 节点上。</p><p>部署工作负载的 <code>worker</code> 节点通常是 Windows 节点,但必须至少有一个 <code>worker</code> 节点运行在 Linux 上,才能按顺序运行 Rancher Cluster Agent、DNS、Metrics Server 和 Ingress 相关容器。</p><p>我们推荐下表中列出的三节点架构,但你始终可以添加额外的 Linux 和 Windows worker 节点来扩展集群,从而实现冗余:</p><a id="guide-architecture"></a><table><thead><tr><th>节点</th><th>操作系统</th><th>Kubernetes 集群角色</th><th>用途</th></tr></thead><tbody><tr><td>节点 1</td><td>Linux(推荐 Ubuntu Server 18.04)</td><td>controlplane, etcd, worker</td><td>管理 Kubernetes 集群</td></tr><tr><td>节点 2</td><td>Linux(推荐 Ubuntu Server 18.04)</td><td>Worker</td><td>支持集群的 Rancher Cluster Agent、Metrics Server、DNS 和 Ingress</td></tr><tr><td>节点 3</td><td>Windows(Windows Server 核心版本 1809 或更高版本)</td><td>Worker</td><td>运行 Windows 容器</td></tr></tbody></table><h3 class="anchor anchorWithStickyNavbar_LWe7" id="容器要求">容器要求<a class="hash-link" href="#容器要求" title="标题的直接链接">​</a></h3><p>Windows 要求容器的版本必须与部署容器的 Windows Server 的版本一致。因此,你必须在 Windows Server 核心版本 1809 或更高版本上构建容器。如果你已经使用早期的 Windows Server 核心版本构建了容器,则必须使用 Windows Server 核心版本 1809 或更高版本重新构建容器。</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="云提供商要求">云提供商要求<a class="hash-link" href="#云提供商要求" title="标题的直接链接">​</a></h3><p>如果你在集群中设置了 Kubernetes 云提供商,则需要进行一些额外的操作。如果你想使用云提供商的功能,例如为集群自动配置存储、负载均衡器或其他基础设施,你可能需要设置云提供商。有关如何配置满足条件的云提供商集群节点,请参阅<a href="/zh/pages-for-subheaders/set-up-cloud-providers">此页面</a>。</p><p>如果你的云提供商是 GCE(Google Compute Engine),则必须执行以下操作:</p><ul><li>按照<a href="/zh/how-to-guides/new-user-guides/kubernetes-clusters-in-rancher-setup/set-up-cloud-providers/google-compute-engine">步骤</a> 在<code>cluster.yml</code> 中启用 GCE 云提供商。</li><li>在 Rancher 中配置集群时,在 Rancher UI 中选择<strong>自定义云提供商</strong>作为云提供商。</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="教程如何创建支持-windows-的集群">教程:如何创建支持 Windows 的集群<a class="hash-link" href="#教程如何创建支持-windows-的集群" title="标题的直接链接">​</a></h2><p>本教程描述了如何使用<a href="#guide-architecture">推荐架构</a>中的三个节点创建由 Rancher 配置的集群。</p><p>在现有节点上使用 Rancher 配置集群时,你需要在每个节点上安装 <a href="/zh/reference-guides/cluster-configuration/rancher-server-configuration/use-existing-nodes/rancher-agent-options">Rancher Agent</a> 来将节点添加到集群中。在 Rancher UI 中创建或编辑集群时,你会看到一个<strong>自定义节点运行命令</strong>,你可以在每台服务器上运行该命令,从而将服务器添加到集群中。</p><p>要设置支持 Windows 节点和容器的集群,你需要完成以下任务:</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="1-配置主机">1. 配置主机<a class="hash-link" href="#1-配置主机" title="标题的直接链接">​</a></h3><p>要在具有 Windows 支持的现有节点上配置集群,请准备好你的主机。</p><p>主机可以是:</p><ul><li>云托管的虚拟机</li><li>虚拟化集群中的虚拟机</li><li>裸金属服务器</li></ul><p>你将配置三个节点:</p><ul><li>一个 Linux 节点,用于管理 Kubernetes controlplane 并存储你的 <code>etcd</code>。</li><li>第二个 Linux 节点,它将作为 worker 节点。</li><li>Windows 节点,它将作为 worker 节点运行 Windows 容器。</li></ul><table><thead><tr><th>节点</th><th>操作系统</th></tr></thead><tbody><tr><td>节点 1</td><td>Linux(推荐 Ubuntu Server 18.04)</td></tr><tr><td>节点 2</td><td>Linux(推荐 Ubuntu Server 18.04)</td></tr><tr><td>节点 3</td><td>Windows(Windows Server 核心版本 1809 或更高版本)</td></tr></tbody></table><p>如果你的节点托管在<strong>云提供商</strong>上,并且你需要自动化支持(例如负载均衡器或持久存储设备),你的节点还需要满足额外的配置要求。详情请参见<a href="/zh/pages-for-subheaders/set-up-cloud-providers">选择云提供商</a>。</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="2-在现有节点上创建集群">2. 在现有节点上创建集群<a class="hash-link" href="#2-在现有节点上创建集群" title="标题的直接链接">​</a></h3><p>在现有节点上创建 Windows 集群的说明与一般<a href="/zh/pages-for-subheaders/use-existing-nodes">创建自定义集群的说明</a>非常相似,但有一些特定于 Windows 的要求。</p><ol><li>在左上角,单击 <strong>☰ &gt; 集群管理</strong>。</li><li>在<strong>集群</strong>页面上,单击<strong>创建</strong>。</li><li>单击<strong>自定义</strong>。</li><li>在<strong>集群名称</strong>字段中输入集群的名称。</li><li>在 <strong>Kubernetes 版本</strong>下拉菜单中,选择 v1.19 或更高版本。</li><li>在<strong>网络提供商</strong>字段中,选择 <strong>Flannel</strong>。</li><li>在 <strong>Windows 支持</strong>中,单击<strong>启用</strong>。</li><li>可选:启用 Windows 支持后,你将能够选择 Flannel 后端模式。有两个网络选项:<a href="https://github.com/coreos/flannel/blob/master/Documentation/backends.md#host-gw" target="_blank" rel="noopener noreferrer"><strong>Host Gateway (L2bridge)</strong></a> 和 <a href="https://github.com/coreos/flannel/blob/master/Documentation/backends.md#vxlan" target="_blank" rel="noopener noreferrer"><strong>VXLAN (Overlay)</strong></a>。默认选项是 <strong>VXLAN (Overlay)</strong> 模式。</li><li>点击<strong>下一步</strong>。</li></ol><div class="theme-admonition theme-admonition-note alert alert--secondary admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></span>重要提示:</div><div class="admonitionContent_S0QG"><p>对于 <b>Host Gateway (L2bridge)</b> 网络,最好为所有节点使用相同的第 2 层网络。否则,你需要为它们配置路由规则。有关详细信息,请参阅<a href="/zh/how-to-guides/new-user-guides/kubernetes-clusters-in-rancher-setup/use-windows-clusters/network-requirements-for-host-gateway#%E4%BA%91%E6%89%98%E7%AE%A1%E8%99%9A%E6%8B%9F%E6%9C%BA%E7%9A%84%E8%B7%AF%E7%94%B1%E9%85%8D%E7%BD%AE">配置云托管 VM 路由的文档</a>。如果你使用的是 Amazon EC2、Google GCE 或 Azure 虚拟机,你需要<a href="/zh/how-to-guides/new-user-guides/kubernetes-clusters-in-rancher-setup/use-windows-clusters/network-requirements-for-host-gateway#%E7%A6%81%E7%94%A8%E7%A7%81%E6%9C%89-ip-%E5%9C%B0%E5%9D%80%E6%A3%80%E6%9F%A5">禁用私有 IP 地址检查</a>。</p></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="3-将节点添加到集群">3. 将节点添加到集群<a class="hash-link" href="#3-将节点添加到集群" title="标题的直接链接">​</a></h3><p>本节介绍如何将 Linux 和 Worker 节点注册到集群。你将在每个节点上运行一个命令,该命令将安装 Rancher Agent 并允许 Rancher 管理每个节点。</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="添加-linux-master-节点">添加 Linux master 节点<a class="hash-link" href="#添加-linux-master-节点" title="标题的直接链接">​</a></h4><p>在本节中,你需要在 Rancher UI 上填写表单以获取自定义命令,从而在 Linux master 节点上安装 Rancher Agent。然后,复制该命令并在 Linux master 节点上运行命令,从而在集群中注册该节点。</p><p>集群中的第一个节点应该是具有 <strong>controlplane</strong> 和 <strong>etcd</strong> 角色的 Linux 主机。至少必须为此节点启用这两个角色,并且必须先将此节点添加到集群中,然后才能添加 Windows 主机。</p><ol><li>在<strong>节点操作系统</strong>中,单击 <strong>Linux</strong>。</li><li>在<strong>节点角色</strong>中,至少选择 <strong>etcd</strong> 和 <strong>controlplane</strong>。推荐选择所有的三个角色。</li><li>可选:如果点击<strong>显示高级选项</strong>,你可以自定义 <a href="/zh/reference-guides/cluster-configuration/rancher-server-configuration/use-existing-nodes/rancher-agent-options">Rancher Agent</a> 和<a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/" target="_blank" rel="noopener noreferrer">节点标签</a>的设置。</li><li>将屏幕上显示的命令复制到剪贴板。</li><li>SSH 到你的 Linux 主机,然后运行复制到剪贴板的命令。</li><li>完成配置 Linux 节点后,选择<strong>完成</strong>。</li></ol><p><strong>结果</strong>:</p><p>你已创建集群,集群的状态是<strong>配置中</strong>。Rancher 已在你的集群中。</p><p>当集群状态变为 <strong>Active</strong> 后,你可访问集群。</p><p><strong>Active</strong> 状态的集群会分配到两个项目:</p><ul><li><code>Default</code>:包含 <code>default</code> 命名空间</li><li><code>System</code>:包含 <code>cattle-system</code>,<code>ingress-nginx</code>,<code>kube-public</code> 和 <code>kube-system</code> 命名空间。</li></ul><p>节点可能需要几分钟才能注册到集群中。</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="添加-linux-worker-节点">添加 Linux Worker 节点<a class="hash-link" href="#添加-linux-worker-节点" title="标题的直接链接">​</a></h4><p>在本节中,我们通过运行命令将 Linux Worker 节点注册到集群中。</p><p>在初始配置集群之后,你的集群只有一个 Linux 主机。接下来,我们添加另一个 Linux <code>worker</code> 主机,用于支持集群的 <em>Rancher Cluster Agent</em>、<em>Metrics Server</em>、<em>DNS</em> 和 <em>Ingress</em>。</p><ol><li>在左上角,单击 <strong>☰ &gt; 集群管理</strong>。</li><li>转到你创建的集群,然后单击 <strong>⋮ &gt; 编辑配置</strong>。</li><li>向下滚动到<strong>节点操作系统</strong>。选择 <strong>Linux</strong>。</li><li>在<strong>自定义节点运行命令</strong>中,转到<strong>节点选项</strong>并选择 <strong>Worker</strong> 角色。</li><li>将屏幕上显示的命令复制到剪贴板。</li><li>使用远程终端连接登录到你的 Linux 主机。粘贴剪贴板的命令并运行。</li><li>在 <strong>Rancher</strong>中,单击<strong>保存</strong>。</li></ol><p><strong>结果</strong>:<strong>Worker</strong> 角色已安装在你的 Linux 主机上,并且节点会向 Rancher 注册。节点可能需要几分钟才能注册到集群中。</p><div class="theme-admonition theme-admonition-note alert alert--secondary admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></span>备注</div><div class="admonitionContent_S0QG"><p>Linux Worker 节点上的污点</p><p>以下污点将添加集群中的 Linux Worker 节点中。将此污点添加到 Linux Worker 节点后,添加到 Windows 集群的任何工作负载都将自动调度到 Windows Worker 节点。如果想将工作负载专门调度到 Linux Worker 节点上,则需要为这些工作负载添加容忍度。</p><table><thead><tr><th>污点键</th><th>污点值</th><th>污点效果</th></tr></thead><tbody><tr><td><code>cattle.io/os</code></td><td><code>linux</code></td><td><code>NoSchedule</code></td></tr></tbody></table></div></div><h4 class="anchor anchorWithStickyNavbar_LWe7" id="添加-windows-worker-节点">添加 Windows Worker 节点<a class="hash-link" href="#添加-windows-worker-节点" title="标题的直接链接">​</a></h4><p>在本节中,我们通过运行命令将 Windows Worker 节点注册到集群中。</p><p>你可以通过编辑集群并选择 <strong>Windows</strong> 选项,从而将 Windows 主机添加到集群中。</p><ol><li>在左上角,单击 <strong>☰ &gt; 集群管理</strong>。</li><li>转到你创建的集群,然后单击 <strong>⋮ &gt; 编辑配置</strong>。</li><li>向下滚动到<strong>节点操作系统</strong>。选择 <strong>Windows</strong>。注意:你将看到 <strong>worker</strong> 角色是唯一可用的角色。</li><li>将屏幕上显示的命令复制到剪贴板。</li><li>使用你喜欢的工具(例如 <a href="https://docs.microsoft.com/en-us/windows-server/remote/remote-desktop-services/clients/remote-desktop-clients" target="_blank" rel="noopener noreferrer">Microsoft 远程桌面</a>)登录到 Windows 主机。在 <strong>Command Prompt (CMD)</strong> 中运行复制到剪贴板的命令。</li><li>在 Rancher 中,单击<strong>保存</strong>。</li><li>可选:如果要向集群添加更多 Windows 节点,请重复这些操作。</li></ol><p><strong>结果</strong>:<strong>Worker</strong> 角色已安装在你的 Windows 主机上,并且节点会向 Rancher 注册。节点可能需要几分钟才能注册到集群中。你现在已拥有一个 Windows Kubernetes 集群。</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="可选的后续步骤">可选的后续步骤<a class="hash-link" href="#可选的后续步骤" title="标题的直接链接">​</a></h3><p>创建集群后,你可以通过 Rancher UI 访问集群。最佳实践建议你设置以下访问集群的备用方式:</p><ul><li><strong>通过 kubectl CLI 访问你的集群</strong>:按照<a href="/zh/how-to-guides/new-user-guides/manage-clusters/access-clusters/use-kubectl-and-kubeconfig#%E5%9C%A8%E5%B7%A5%E4%BD%9C%E7%AB%99%E4%BD%BF%E7%94%A8-kubectl-%E8%AE%BF%E9%97%AE%E9%9B%86%E7%BE%A4">这些步骤</a>在你的工作站上使用 kubectl 访问集群。在这种情况下,你将通过 Rancher Server 的身份验证代理进行身份验证,然后 Rancher 会让你连接到下游集群。此方法允许你在没有 Rancher UI 的情况下管理集群。</li><li><strong>通过 kubectl CLI 使用授权的集群端点访问你的集群</strong>:按照<a href="/zh/how-to-guides/new-user-guides/manage-clusters/access-clusters/use-kubectl-and-kubeconfig#%E7%9B%B4%E6%8E%A5%E4%BD%BF%E7%94%A8%E4%B8%8B%E6%B8%B8%E9%9B%86%E7%BE%A4%E8%BF%9B%E8%A1%8C%E8%BA%AB%E4%BB%BD%E9%AA%8C%E8%AF%81">这些步骤</a>直接使用 kubectl 访问集群,而无需通过 Rancher Server 进行身份验证。我们建议设置此替代方法来访问集群,以便在无法连接到 Rancher 时访问集群。</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="azure-中存储类的配置">Azure 中存储类的配置<a class="hash-link" href="#azure-中存储类的配置" title="标题的直接链接">​</a></h2><p>如果你的节点使用 Azure VM,则可以使用 <a href="https://docs.microsoft.com/en-us/azure/aks/azure-files-dynamic-pv" target="_blank" rel="noopener noreferrer">Azure 文件</a>作为集群的存储类(StorageClass)。详情请参见<a href="/zh/how-to-guides/new-user-guides/kubernetes-clusters-in-rancher-setup/use-windows-clusters/azure-storageclass-configuration">此部分</a>。</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/rancher/rancher-docs/edit/main/docs/pages-for-subheaders/use-windows-clusters.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>编辑此页</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">最后<!-- -->于 <b><time datetime="2022-10-25T20:41:06.000Z">2022年10月25日</time></b> <!-- -->更新</span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="文档分页导航"><a class="pagination-nav__link pagination-nav__link--prev" href="/zh/how-to-guides/new-user-guides/kubernetes-clusters-in-rancher-setup/set-up-clusters-from-hosted-kubernetes-providers/huawei"><div class="pagination-nav__sublabel">上一页</div><div class="pagination-nav__label">创建华为 CCE 集群</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/zh/how-to-guides/new-user-guides/kubernetes-clusters-in-rancher-setup/use-windows-clusters/azure-storageclass-configuration"><div class="pagination-nav__sublabel">下一页</div><div class="pagination-nav__label">Azure 中存储类的配置</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#rancher-26-变更" class="table-of-contents__link toc-highlight">Rancher 2.6 变更</a><ul><li><a href="#rke2-windows" class="table-of-contents__link toc-highlight">RKE2 Windows</a></li></ul></li><li><a href="#windows-集群的要求" class="table-of-contents__link toc-highlight">Windows 集群的要求</a><ul><li><a href="#操作系统和-docker-要求" class="table-of-contents__link toc-highlight">操作系统和 Docker 要求</a></li><li><a href="#kubernetes-版本" class="table-of-contents__link toc-highlight">Kubernetes 版本</a></li><li><a href="#节点要求" class="table-of-contents__link toc-highlight">节点要求</a></li><li><a href="#网络要求" class="table-of-contents__link toc-highlight">网络要求</a></li><li><a href="#带有-esxi-67u2-及更高版本的-vsphere-上的-rancher" class="table-of-contents__link toc-highlight">带有 ESXi 6.7u2 及更高版本的 vSphere 上的 Rancher</a></li><li><a href="#架构要求" class="table-of-contents__link toc-highlight">架构要求</a></li><li><a href="#容器要求" class="table-of-contents__link toc-highlight">容器要求</a></li><li><a href="#云提供商要求" class="table-of-contents__link toc-highlight">云提供商要求</a></li></ul></li><li><a href="#教程如何创建支持-windows-的集群" class="table-of-contents__link toc-highlight">教程:如何创建支持 Windows 的集群</a><ul><li><a href="#1-配置主机" class="table-of-contents__link toc-highlight">1. 配置主机</a></li><li><a href="#2-在现有节点上创建集群" class="table-of-contents__link toc-highlight">2. 在现有节点上创建集群</a></li><li><a href="#3-将节点添加到集群" class="table-of-contents__link toc-highlight">3. 将节点添加到集群</a></li><li><a href="#可选的后续步骤" class="table-of-contents__link toc-highlight">可选的后续步骤</a></li></ul></li><li><a href="#azure-中存储类的配置" class="table-of-contents__link toc-highlight">Azure 中存储类的配置</a></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">Copyright © 2022 SUSE Rancher. All Rights Reserved.</div></div></div></footer></div>
<script src="/zh/assets/js/runtime~main.ee5c32f6.js"></script>
<script src="/zh/assets/js/main.bc269412.js"></script>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-57KS2MW" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) --></body>
</html>