本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
為 Windows Pod 和容器設定 gMSA
什麼是 gMSA 帳戶
.NET 應用程式等 Windows 型應用程式通常會使用 Active Directory 做為身分提供者,使用 NTLM 或 Kerberos 通訊協定提供授權/身分驗證。
與 Active Directory 交換 Kerberos 票證的應用程式伺服器需要加入網域。Windows 容器不支援網域聯結,而且由於容器是暫時性資源,對 Active Directory RID 集區造成負擔,因此並不那麼合理。
不過,管理員可以利用 gMSA Active Directory
Windows 容器和 gMSA 使用案例
利用 Windows 身分驗證並以 Windows 容器執行的應用程式受益於 gMSA,因為 Windows 節點用於代表容器交換 Kerberos 票證。有兩個選項可用於設定 Windows 工作者節點以支援 gMSA 整合:
在此設定中,Windows 工作者節點在 Active Directory 網域中加入網域,Windows 工作者節點的 AD 電腦帳戶用於對 Active Directory 進行身分驗證,並擷取要與 Pod 搭配使用的 gMSA 身分。
在加入網域的方法中,您可以使用現有的 Active Directory GPOs 輕鬆管理和強化 Windows 工作者節點;不過,在加入 Kubernetes 叢集的 Windows 工作者節點期間會產生額外的操作額外負荷和延遲,因為它需要在節點啟動期間進行額外的重新啟動,並在 Kubernetes 叢集終止節點後進行 Active Directory 車庫清理。
在下列部落格文章中,您將找到如何實作加入網域的 Windows 工作者節點方法的詳細step-by-step說明:
Amazon EKS Windows Pod 上的 Windows 身分驗證
在此設定中,Windows 工作者節點不會加入 Active Directory 網域中,而且會使用「可攜式」身分 (使用者/密碼) 對 Active Directory 進行身分驗證,並擷取要與 Pod 搭配使用的 gMSA 身分。

可攜式身分是 Active Directory 使用者;身分 (使用者/密碼) 存放在 AWS Secrets Manager 或 AWS System Manager 參數存放區中,而稱為 ccg_plugin 的 AWS 開發外掛程式將用於從 AWS Secrets Manager 或 AWS System Manager 參數存放區擷取此身分,並將其傳遞至容器以擷取 gMSA 身分,並將其提供給 Pod。
在此無網域方法中,您可以在使用 gMSA 時,在 Windows 工作者節點啟動期間不進行任何 Active Directory 互動,並降低 Active Directory 管理員的操作開銷。
在下列部落格文章中,您將找到如何實作無網域 Windows 工作者節點方法的詳細step-by-step說明:
Amazon EKS Windows Pod 的無網域 Windows 身分驗證
雖然 Pod 能夠使用 gMSA 帳戶,但也必須相應地設定應用程式或服務以支援 Windows 身分驗證,例如,若要設定 Microsoft IIS 以支援 Windows 身分驗證,您應該透過 dockerfile 進行準備:
RUN Install-WindowsFeature -Name Web-Windows-Auth -IncludeAllSubFeature RUN Import-Module WebAdministration; Set-ItemProperty 'IIS:\AppPools\SiteName' -name processModel.identityType -value 2 RUN Import-Module WebAdministration; Set-WebConfigurationProperty -Filter '/system.webServer/security/authentication/anonymousAuthentication' -Name Enabled -Value False -PSPath 'IIS:\' -Location 'SiteName' RUN Import-Module WebAdministration; Set-WebConfigurationProperty -Filter '/system.webServer/security/authentication/windowsAuthentication' -Name Enabled -Value True -PSPath 'IIS:\' -Location 'SiteName'