Skip to content

Commit d2b9f0e

Browse files
committed
fix linting/whitespace in configure-gmsa.md
1 parent 7012c97 commit d2b9f0e

File tree

1 file changed

+26
-19
lines changed

1 file changed

+26
-19
lines changed

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

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,17 @@ This page shows how to configure [Group Managed Service Accounts](https://docs.m
1212

1313
In Kubernetes, GMSA credential specs are configured at a Kubernetes cluster-wide scope as Custom Resources. Windows Pods, as well as individual containers within a Pod, can be configured to use a GMSA for domain based functions (e.g. Kerberos authentication) when interacting with other Windows services. As of v1.16, the Docker runtime supports GMSA for Windows workloads.
1414

15-
16-
1715
## {{% heading "prerequisites" %}}
1816

19-
2017
You need to have a Kubernetes cluster and the `kubectl` command-line tool must be configured to communicate with your cluster. The cluster is expected to have Windows worker nodes. This section covers a set of initial steps required once for each cluster:
2118

2219
### Install the GMSACredentialSpec CRD
20+
2321
A [CustomResourceDefinition](/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/)(CRD) for GMSA credential spec resources needs to be configured on the cluster to define the custom resource type `GMSACredentialSpec`. Download the GMSA CRD [YAML](https://github.com/kubernetes-sigs/windows-gmsa/blob/master/admission-webhook/deploy/gmsa-crd.yml) and save it as gmsa-crd.yaml.
2422
Next, install the CRD with `kubectl apply -f gmsa-crd.yaml`
2523

2624
### Install webhooks to validate GMSA users
25+
2726
Two webhooks need to be configured on the Kubernetes cluster to populate and validate GMSA credential spec references at the Pod or container level:
2827

2928
1. A mutating webhook that expands references to GMSAs (by name from a Pod specification) into the full credential spec in JSON form within the Pod spec.
@@ -36,33 +35,33 @@ Installing the above webhooks and associated objects require the steps below:
3635

3736
1. Install a secret with the certificate from above.
3837

39-
1. Create a deployment for the core webhook logic.
38+
1. Create a deployment for the core webhook logic.
4039

41-
1. Create the validating and mutating webhook configurations referring to the deployment.
40+
1. Create the validating and mutating webhook configurations referring to the deployment.
4241

4342
A [script](https://github.com/kubernetes-sigs/windows-gmsa/blob/master/admission-webhook/deploy/deploy-gmsa-webhook.sh) can be used to deploy and configure the GMSA webhooks and associated objects mentioned above. The script can be run with a ```--dry-run=server``` option to allow you to review the changes that would be made to your cluster.
4443

4544
The [YAML template](https://github.com/kubernetes-sigs/windows-gmsa/blob/master/admission-webhook/deploy/gmsa-webhook.yml.tpl) used by the script may also be used to deploy the webhooks and associated objects manually (with appropriate substitutions for the parameters)
4645

47-
48-
4946
<!-- steps -->
5047

5148
## Configure GMSAs and Windows nodes in Active Directory
49+
5250
Before Pods in Kubernetes can be configured to use GMSAs, the desired GMSAs need to be provisioned in Active Directory as described in the [Windows GMSA documentation](https://docs.microsoft.com/en-us/windows-server/security/group-managed-service-accounts/getting-started-with-group-managed-service-accounts#BKMK_Step1). Windows worker nodes (that are part of the Kubernetes cluster) need to be configured in Active Directory to access the secret credentials associated with the desired GMSA as described in the [Windows GMSA documentation](https://docs.microsoft.com/en-us/windows-server/security/group-managed-service-accounts/getting-started-with-group-managed-service-accounts#to-add-member-hosts-using-the-set-adserviceaccount-cmdlet)
5351

5452
## Create GMSA credential spec resources
55-
With the GMSACredentialSpec CRD installed (as described earlier), custom resources containing GMSA credential specs can be configured. The GMSA credential spec does not contain secret or sensitive data. It is information that a container runtime can use to describe the desired GMSA of a container to Windows. GMSA credential specs can be generated in YAML format with a utility [PowerShell script](https://github.com/kubernetes-sigs/windows-gmsa/tree/master/scripts/GenerateCredentialSpecResource.ps1).
53+
54+
With the GMSACredentialSpec CRD installed (as described earlier), custom resources containing GMSA credential specs can be configured. The GMSA credential spec does not contain secret or sensitive data. It is information that a container runtime can use to describe the desired GMSA of a container to Windows. GMSA credential specs can be generated in YAML format with a utility [PowerShell script](https://github.com/kubernetes-sigs/windows-gmsa/tree/master/scripts/GenerateCredentialSpecResource.ps1).
5655

5756
Following are the steps for generating a GMSA credential spec YAML manually in JSON format and then converting it:
5857

5958
1. Import the CredentialSpec [module](https://github.com/MicrosoftDocs/Virtualization-Documentation/blob/live/windows-server-container-tools/ServiceAccounts/CredentialSpec.psm1): `ipmo CredentialSpec.psm1`
6059

6160
1. Create a credential spec in JSON format using `New-CredentialSpec`. To create a GMSA credential spec named WebApp1, invoke `New-CredentialSpec -Name WebApp1 -AccountName WebApp1 -Domain $(Get-ADDomain -Current LocalComputer)`
6261

63-
1. Use `Get-CredentialSpec` to show the path of the JSON file.
62+
1. Use `Get-CredentialSpec` to show the path of the JSON file.
6463

65-
1. Convert the credspec file from JSON to YAML format and apply the necessary header fields `apiVersion`, `kind`, `metadata` and `credspec` to make it a GMSACredentialSpec custom resource that can be configured in Kubernetes.
64+
1. Convert the credspec file from JSON to YAML format and apply the necessary header fields `apiVersion`, `kind`, `metadata` and `credspec` to make it a GMSACredentialSpec custom resource that can be configured in Kubernetes.
6665

6766
The following YAML configuration describes a GMSA credential spec named `gmsa-WebApp1`:
6867

@@ -92,6 +91,7 @@ credspec:
9291
The above credential spec resource may be saved as `gmsa-Webapp1-credspec.yaml` and applied to the cluster using: `kubectl apply -f gmsa-Webapp1-credspec.yml`
9392

9493
## Configure cluster role to enable RBAC on specific GMSA credential specs
94+
9595
A cluster role needs to be defined for each GMSA credential spec resource. This authorizes the `use` verb on a specific GMSA resource by a subject which is typically a service account. The following example shows a cluster role that authorizes usage of the `gmsa-WebApp1` credential spec from above. Save the file as gmsa-webapp1-role.yaml and apply using `kubectl apply -f gmsa-webapp1-role.yaml`
9696

9797
```yaml
@@ -108,6 +108,7 @@ rules:
108108
```
109109

110110
## Assign role to service accounts to use specific GMSA credspecs
111+
111112
A service account (that Pods will be configured with) needs to be bound to the cluster role create above. This authorizes the service account to use the desired GMSA credential spec resource. The following shows the default service account being bound to a cluster role `webapp1-role` to use `gmsa-WebApp1` credential spec resource created above.
112113

113114
```yaml
@@ -127,6 +128,7 @@ roleRef:
127128
```
128129

129130
## Configure GMSA credential spec reference in Pod spec
131+
130132
The Pod spec field `securityContext.windowsOptions.gmsaCredentialSpecName` is used to specify references to desired GMSA credential spec custom resources in Pod specs. This configures all containers in the Pod spec to use the specified GMSA. A sample Pod spec with the annotation populated to refer to `gmsa-WebApp1`:
131133

132134
```yaml
@@ -197,18 +199,19 @@ As Pod specs with GMSA fields populated (as described above) are applied in a cl
197199

198200
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.
199201

200-
## Containerd
202+
## Containerd
201203

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).
204+
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).
203205

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.
206+
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.
205207

206208
```PowerShell
207209
ping adserver.ad.local
208210
```
211+
209212
and correctly resolves the hostname to an IPv4 address. The output is similar to:
210213

211-
```
214+
```PowerShell
212215
Pinging adserver.ad.local [192.168.111.18] with 32 bytes of data:
213216
Reply from 192.168.111.18: bytes=32 time=6ms TTL=124
214217
Reply from 192.168.111.18: bytes=32 time=5ms TTL=124
@@ -224,7 +227,7 @@ cd \\adserver.ad.local\test
224227

225228
you see an error that implies the target share doesn't exist:
226229

227-
```
230+
```PowerShell
228231
cd : Cannot find path '\\adserver.ad.local\test' because it does not exist.
229232
At line:1 char:1
230233
+ cd \\adserver.ad.local\test
@@ -241,7 +244,7 @@ cd \\192.168.111.18\test
241244

242245
After you change into a directory within the share, you see a prompt similar to:
243246

244-
```
247+
```PowerShell
245248
Microsoft.PowerShell.Core\FileSystem::\\192.168.111.18\test>
246249
```
247250

@@ -258,8 +261,10 @@ In the example below the Pod did not get the credspec correctly:
258261
```PowerShell
259262
kubectl exec -it iis-auth-7776966999-n5nzr powershell.exe
260263
```
264+
261265
`nltest.exe /parentdomain` results in the following error:
262-
```
266+
267+
```PowerShell
263268
Getting parent domain failed: Status = 1722 0x6ba RPC_S_SERVER_UNAVAILABLE
264269
```
265270

@@ -278,7 +283,8 @@ nltest.exe /query
278283
```
279284

280285
Results in the following output:
281-
```
286+
287+
```PowerShell
282288
I_NetLogonControl failed: Status = 1722 0x6ba RPC_S_SERVER_UNAVAILABLE
283289
```
284290

@@ -289,7 +295,8 @@ nltest /sc_reset:domain.example
289295
```
290296

291297
If the command is successful you will see and output similar to this:
292-
```
298+
299+
```PowerShell
293300
Flags: 30 HAS_IP HAS_TIMESERV
294301
Trusted DC Name \\dc10.domain.example
295302
Trusted DC Connection Status Status = 0 0x0 NERR_Success

0 commit comments

Comments
 (0)