Skip to content

Commit 5d2f1a3

Browse files
authored
Merge pull request #27131 from perithompson/containerd-gsma
Added Windows Containerd GMSA Updates
2 parents bf40d49 + 39e22be commit 5d2f1a3

File tree

2 files changed

+71
-27
lines changed

2 files changed

+71
-27
lines changed

content/en/docs/setup/production-environment/windows/intro-windows-in-kubernetes.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,6 @@ also be used as the container runtime for Windows Kubernetes nodes.
188188
Learn how to
189189
[install ContainerD on a Windows](/docs/setup/production-environment/container-runtimes/#install-containerd).
190190

191-
{{< caution >}}
192-
There is a [known limitation](/docs/tasks/configure-pod-container/configure-gmsa/#gmsa-limitations)
193-
when using GMSA with ContainerD to access Windows network shares which
194-
requires a kernel patch. Updates to address this limitation are currently
195-
available for Windows Server, Version 2004 and will be available for Windows
196-
Server 2019 in early 2021. Check for updates on the
197-
[Microsoft Windows Containers issue tracker](https://github.com/microsoft/Windows-Containers/issues/44).
198-
{{< /caution >}}
199-
200191
#### Persistent Storage
201192

202193
Kubernetes [volumes](/docs/concepts/storage/volumes/) enable complex

content/en/docs/tasks/configure-pod-container/configure-gmsa.md

Lines changed: 71 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -197,21 +197,70 @@ As Pod specs with GMSA fields populated (as described above) are applied in a cl
197197

198198
1. The container runtime configures each Windows container with the specified GMSA credential spec so that the container can assume the identity of the GMSA in Active Directory and access services in the domain using that identity.
199199

200+
## Containerd
201+
202+
On Windows Server 2019, in order to use GMSA with containerd, you must be running OS Build 17763.1817 (or later) which can be installed using the patch [KB5000822](https://support.microsoft.com/en-us/topic/march-9-2021-kb5000822-os-build-17763-1817-2eb6197f-e3b1-4f42-ab51-84345e063564).
203+
204+
There is also a known issue with containerd that occurs when trying to connect to SMB shares from Pods. Once you have configured GMSA, the pod will be unable to connect to the share using the hostname or FQDN, but connecting to the share using an IP address works as expected.
205+
206+
```PowerShell
207+
ping adserver.ad.local
208+
```
209+
and correctly resolves the hostname to an IPv4 address. The output is similar to:
210+
211+
```
212+
Pinging adserver.ad.local [192.168.111.18] with 32 bytes of data:
213+
Reply from 192.168.111.18: bytes=32 time=6ms TTL=124
214+
Reply from 192.168.111.18: bytes=32 time=5ms TTL=124
215+
Reply from 192.168.111.18: bytes=32 time=5ms TTL=124
216+
Reply from 192.168.111.18: bytes=32 time=5ms TTL=124
217+
```
218+
219+
However, when attempting to browse the directory using the hostname
220+
221+
```PowerShell
222+
cd \\adserver.ad.local\test
223+
```
224+
225+
you see an error that implies the target share doesn't exist:
226+
227+
```
228+
cd : Cannot find path '\\adserver.ad.local\test' because it does not exist.
229+
At line:1 char:1
230+
+ cd \\adserver.ad.local\test
231+
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
232+
+ CategoryInfo : ObjectNotFound: (\\adserver.ad.local\test:String) [Set-Location], ItemNotFoundException
233+
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
234+
```
235+
236+
but you notice that the error disappears if you browse to the share using its IPv4 address instead; for example:
237+
238+
```PowerShell
239+
cd \\192.168.111.18\test
240+
```
241+
242+
After you change into a directory within the share, you see a prompt similar to:
243+
244+
```
245+
Microsoft.PowerShell.Core\FileSystem::\\192.168.111.18\test>
246+
```
247+
248+
To correct the behaviour you must run the following on the node `reg add "HKLM\SYSTEM\CurrentControlSet\Services\hns\State" /v EnableCompartmentNamespace /t REG_DWORD /d 1` to add the required registry key. This node change will only take effect in newly created pods, meaning you must now recreate any running pods which require access to SMB shares.
249+
200250
## Troubleshooting
201251

202252
If you are having difficulties getting GMSA to work in your environment, there are a few troubleshooting steps you can take.
203253

204-
First, make sure the credspec has been passed to the Pod. To do this you will need to `exec` into one of your Pods and check the output of the `nltest.exe /parentdomain` command. In the example below the Pod did not get the credspec correctly:
254+
First, make sure the credspec has been passed to the Pod. To do this you will need to `exec` into one of your Pods and check the output of the `nltest.exe /parentdomain` command.
205255

206-
```shell
207-
kubectl exec -it iis-auth-7776966999-n5nzr powershell.exe
208-
209-
Windows PowerShell
210-
Copyright (C) Microsoft Corporation. All rights reserved.
256+
In the example below the Pod did not get the credspec correctly:
211257

212-
PS C:\> nltest.exe /parentdomain
258+
```PowerShell
259+
kubectl exec -it iis-auth-7776966999-n5nzr powershell.exe
260+
```
261+
nltest.exe /parentdomain` results in the following error:
262+
```
213263
Getting parent domain failed: Status = 1722 0x6ba RPC_S_SERVER_UNAVAILABLE
214-
PS C:\>
215264
```
216265

217266
If your Pod did get the credspec correctly, then next check communication with the domain. First, from inside of your Pod, quickly do an nslookup to find the root of your domain.
@@ -224,23 +273,30 @@ This will tell us 3 things:
224273

225274
If the DNS and communication test passes, next you will need to check if the Pod has established secure channel communication with the domain. To do this, again, `exec` into your Pod and run the `nltest.exe /query` command.
226275

227-
```shell
228-
PS C:\> nltest.exe /query
276+
```PowerShell
277+
nltest.exe /query
278+
```
279+
280+
Results in the following output:
281+
```
229282
I_NetLogonControl failed: Status = 1722 0x6ba RPC_S_SERVER_UNAVAILABLE
230283
```
231284

232-
This tells us that for some reason, the Pod was unable to logon to the domain using the account specified in the credspec. You can try to repair the secure channel by running the `nltest.exe /sc_reset:domain.example` command.
285+
This tells us that for some reason, the Pod was unable to logon to the domain using the account specified in the credspec. You can try to repair the secure channel by running the following:
233286

234-
```shell
235-
PS C:\> nltest /sc_reset:domain.example
287+
```PowerShell
288+
nltest /sc_reset:domain.example
289+
```
290+
291+
If the command is successful you will see and output similar to this:
292+
```
236293
Flags: 30 HAS_IP HAS_TIMESERV
237294
Trusted DC Name \\dc10.domain.example
238295
Trusted DC Connection Status Status = 0 0x0 NERR_Success
239296
The command completed successfully
240-
PS C:\>
241297
```
242298

243-
If the above command corrects the error, you can automate the step by adding the following lifecycle hook to your Pod spec. If it did not correct the error, you will need to examine your credspec again and confirm that it is correct and complete.
299+
If the above corrects the error, you can automate the step by adding the following lifecycle hook to your Pod spec. If it did not correct the error, you will need to examine your credspec again and confirm that it is correct and complete.
244300

245301
```yaml
246302
image: registry.domain.example/iis-auth:1809v1
@@ -252,6 +308,3 @@ If the above command corrects the error, you can automate the step by adding the
252308
```
253309

254310
If you add the `lifecycle` section show above to your Pod spec, the Pod will execute the commands listed to restart the `netlogon` service until the `nltest.exe /query` command exits without error.
255-
256-
## GMSA limitations
257-
When using the [ContainerD runtime for Windows](/docs/setup/production-environment/windows/intro-windows-in-kubernetes/#cri-containerd) accessing restricted network shares via the GMSA domain identity fails. The container will receive the identity of and calls from `nltest.exe /query` will work. It is recommended to use the [Docker EE runtime](/docs/setup/production-environment/windows/intro-windows-in-kubernetes/#docker-ee) if access to network shares is required. The Windows Server team is working on resolving the issue in the Windows Kernel and will release a patch to resolve this issue in the future. Look for updates on the [Microsoft Windows Containers issue tracker](https://github.com/microsoft/Windows-Containers/issues/44).

0 commit comments

Comments
 (0)