You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: support/azure/azure-kubernetes/security/troubleshoot-aks-control-plane-authentication-external-identity-providers.md
+46-46Lines changed: 46 additions & 46 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: Troubleshoot AKS control plane authentication using external identity providers
3
-
description: Helps you troubleshoot authentication issues when accessing the Azure Kubernetes Service control plane using external identity providers
3
+
description: Helps you troubleshoot authentication issues when accessing the Azure Kubernetes Service control plane by using external identity providers
This article helps you troubleshoot authentication issues when accessing the Azure Kubernetes Service (AKS) control plane using external identity providers.
19
+
This article helps you troubleshoot authentication issues when you access the Azure Kubernetes Service (AKS) control plane by using external identity providers.
20
20
21
21
## Prerequisites
22
22
23
-
- Azure CLI version 2.61.0 or later. To determine the version, run `az --version`. If you need to install or upgrade, see [Install Azure CLI](/cli/azure/install-azure-cli).
24
-
- A tool to connect to the Kubernetes cluster, like the `kubectl` tool. To install `kubectl` using Azure CLI, run the [az aks install-cli](/cli/azure/aks#az-aks-install-cli) command.
25
-
- The JSON Web Token (JWT) authenticator configuration file used for your AKS cluster.
23
+
- Azure CLI version 2.61.0 or later. To determine the version, run `az --version`. If you have to install or upgrade, see [Install Azure CLI](/cli/azure/install-azure-cli).
24
+
- A tool to connect to the Kubernetes cluster, such as the `kubectl` tool. To install `kubectl` by using Azure CLI, run the [az aks install-cli](/cli/azure/aks#az-aks-install-cli) command.
25
+
- The JSON Web Token (JWT) authenticator configuration file that's used for your AKS cluster.
26
26
- Access to [jwt.ms][jwt-ms] or a similar JWT token decoder tool for debugging tokens.
Ensure your identity provider is correctly configured and accessible. Use the following steps.
32
+
Make sure that your identity provider is correctly configured and accessible. Follow these steps:
33
33
34
34
::: zone pivot="github"
35
35
36
-
1. Verify your GitHub repository has **Actions** enabled.
37
-
2.Confirm the OpenID Connect (OIDC) provider settings are correctly configured in your workflow.
38
-
3.Ensure the audience claim in your workflow matches the authenticator configuration.
36
+
1. Verify that your GitHub repository has **Actions** enabled.
37
+
2.Verify that the OpenID Connect (OIDC) provider settings are correctly configured in your workflow.
38
+
3.Make sure that the audience claim in your workflow matches the authenticator configuration.
39
39
40
40
::: zone-end
41
41
42
42
::: zone pivot="google-identity"
43
43
44
-
Verify the OAuth 2.0 client ID and client secret are correct.
44
+
Verify that the OAuth 2.0 client ID and client secret are correct.
45
45
46
46
::: zone-end
47
47
48
48
### Step 2: Validate the issuer URL
49
49
50
-
The issuer URL must be accessible from the AKS cluster nodes. Use the following steps.
50
+
The issuer URL must be accessible from the AKS cluster nodes. Follow these steps.
51
51
52
-
1. Verify DNS resolution for the issuer URL.
52
+
1. Verify DNS resolution for the issuer URL:
53
53
54
54
::: zone pivot="github"
55
55
@@ -67,7 +67,7 @@ The issuer URL must be accessible from the AKS cluster nodes. Use the following
67
67
68
68
::: zone-end
69
69
70
-
2. Test network connectivity from a cluster node.
70
+
2. Test network connectivity from a cluster node:
71
71
72
72
::: zone pivot="github"
73
73
@@ -85,16 +85,16 @@ The issuer URL must be accessible from the AKS cluster nodes. Use the following
85
85
86
86
::: zone-end
87
87
88
-
3. Verify firewall rules and network security groups allow outbound HTTPS traffic to the identity provider.
88
+
3. Verify that firewall rules and network security groups allow outbound HTTPS traffic to the identity provider.
89
89
90
90
### Step 3: Inspect the JWT authenticator configuration
91
91
92
-
Review your JWT authenticator configuration for common issues. Use the following steps.
92
+
Review your JWT authenticator configuration for common issues. Follow these steps:
93
93
94
-
1. Verify the issuer URL exactly matches the `iss` claim in your tokens.
95
-
2.Check that the audience claim in the configuration matches the `aud` claim in your tokens.
96
-
3.Ensure Common Expression Language (CEL) expressions in claim mappings are syntactically correct.
97
-
4.Confirm that all username and group mappings include the `aks:jwt:` prefix.
94
+
1. Verify that the issuer URL exactly matches the `iss` claim in your tokens.
95
+
2.Verify that the audience claim in the configuration matches the `aud` claim in your tokens.
96
+
3.Make sure that Common Expression Language (CEL) expressions in claim mappings are syntactically correct.
97
+
4.Verify that all username and group mappings include the `aks:jwt:` prefix.
98
98
99
99
Example configuration:
100
100
@@ -175,11 +175,11 @@ Example configuration:
175
175
176
176
### Step 4: Decode and verify JWT tokens
177
177
178
-
Verify claims and obtain and inspect the JWT token. Use the following steps.
178
+
Verify claims, and obtain and inspect the JWT token. Follow these steps:
179
179
180
180
::: zone pivot="github"
181
181
182
-
1. For GitHub Actions OIDC, tokens are typically obtained within a workflow. Obtain a token.
182
+
1. For GitHub Actions OIDC, tokens are typically obtained within a workflow. Obtain a token:
183
183
184
184
```bash
185
185
# This is typically done within a GitHub Actions workflow
@@ -192,7 +192,7 @@ Verify claims and obtain and inspect the JWT token. Use the following steps.
192
192
193
193
::: zone pivot="google-identity"
194
194
195
-
1. Get a token from Google Identity.
195
+
1. Get a token from Google Identity:
196
196
197
197
```bash
198
198
kubectl oidc-login get-token \
@@ -203,17 +203,17 @@ Verify claims and obtain and inspect the JWT token. Use the following steps.
203
203
204
204
::: zone-end
205
205
206
-
2. Decode the token at [jwt.ms][jwt-ms] and verify the following:
206
+
2. Decode the token at [jwt.ms][jwt-ms], and verify the following items:
207
207
208
208
- The `iss` claim matches your issuer URL exactly.
209
209
- The `aud` claim matches your configured audience.
210
210
- The token isn't expired (`exp` claim).
211
211
- Required claims for username and groups are present.
212
-
- Claims match the format expected by your CEL expressions.
212
+
- Claims match the format that's expected by your CEL expressions.
213
213
214
214
### Step 5: Check AKS API server logs
215
215
216
-
Review the AKS API server logs for authentication errors. Use the following steps.
216
+
Review the AKS API server logs for authentication errors. Follow these steps:
217
217
218
218
1. Use diagnostic settings to [enable resource logs][aks-resource-logs] for your AKS cluster. Choose **Kubernetes API Server** when creating the diagnostic setting.
219
219
2. Check logs in Azure Monitor or Azure Log Analytics for authentication failures.
@@ -229,7 +229,7 @@ The audience claim in the token doesn't match the configured audience in the JWT
229
229
230
230
### Solution: Update the authenticator configuration
231
231
232
-
Verify the audience claim in your token and update the JWT authenticator configuration.
232
+
Verify the audience claim in your token, and update the JWT authenticator configuration.
233
233
234
234
```azurecli-interactive
235
235
az aks jwtauthenticator update \
@@ -255,8 +255,8 @@ The OAuth client or OIDC provider settings are incorrect.
255
255
256
256
::: zone pivot="github"
257
257
258
-
1. Verify the workflow file includes the correct `permissions` for `id-token: write`.
259
-
2.Ensure the `audience` parameter matches your authenticator configuration.
258
+
1. Verify that the workflow file includes the correct `permissions` for `id-token: write`.
259
+
2.Make sure that the `audience` parameter matches your authenticator configuration.
260
260
261
261
::: zone-end
262
262
@@ -274,13 +274,13 @@ The OAuth client or OIDC provider settings are incorrect.
274
274
275
275
CEL expressions might have syntax errors or return unexpected data types.
276
276
277
-
### Solution: Validate CEL expressions
277
+
### Solution: Verify CEL expressions
278
278
279
279
1. Review the CEL expressions in your configuration.
280
-
2. Test expressions using a CEL evaluator to ensure they return strings for username and arrays of strings for groups.
281
-
3. Update the configuration with corrected expressions:
280
+
2. Test expressions by using a CEL evaluator to make sure that they return strings for username and arrays of strings for groups.
281
+
3. Update the configuration to correct the expressions:
282
282
283
-
The following is an example of a valid CEL expression for extracting groups:
283
+
The following code is an example of a valid CEL expression for extracting groups:
284
284
285
285
```json
286
286
{
@@ -295,17 +295,17 @@ The following is an example of a valid CEL expression for extracting groups:
295
295
296
296
**Cause: Cluster nodes cannot reach the identity provider**
297
297
298
-
Network security groups, firewalls, or Domain Name System (DNS) issues prevent the cluster from accessing the identity provider.
298
+
Issues that affect network security groups, firewalls, or Domain Name System prevent the cluster from accessing the identity provider.
299
299
300
300
### Solution 1: Verify DNS resolution
301
301
302
-
1. Connect to a cluster node using `kubectl debug`.
302
+
1. Connect to a cluster node by using `kubectl debug`:
@@ -325,23 +325,23 @@ Network security groups, firewalls, or Domain Name System (DNS) issues prevent t
325
325
326
326
### Solution 2: Update network security rules
327
327
328
-
1. Review network security group rules associated with your AKS cluster.
329
-
2.Ensure outbound HTTPS (port 443) traffic is allowed to your identity provider's domain.
330
-
3. If using Azure Firewall, add application rules for the identity provider URLs.
328
+
1. Review network security group rules that are associated with your AKS cluster.
329
+
2.Make sure that outbound HTTPS (port 443) traffic is allowed to your identity provider's domain.
330
+
3. If you use Azure Firewall, add application rules for the identity provider URLs.
331
331
332
332
### Issue 4: Missing `aks:jwt:` prefix in username or groups
333
333
334
334
**Cause: Claim mappings don't include the required prefix**
335
335
336
-
All usernames and groups must be prefixed with `aks:jwt:` to prevent conflicts with other authentication methods.
336
+
To prevent conflicts with other authentication methods, all usernames and groups must be prefixed by using `aks:jwt:`.
337
337
338
338
### Solution: Add the required prefix
339
339
340
340
Update your JWT authenticator configuration to include the `aks:jwt:` prefix. For example:
341
341
342
342
::: zone pivot="github"
343
343
344
-
For GitHub Actions OIDC, create a file named `jwt-config.json`with the following configuration:
344
+
For GitHub Actions OIDC, create a file that's named `jwt-config.json`that has the following configuration:
345
345
346
346
```json
347
347
{
@@ -381,7 +381,7 @@ For GitHub Actions OIDC, create a file named `jwt-config.json` with the followin
381
381
382
382
### Google OAuth 2.0 Configuration
383
383
384
-
Create a file named `jwt-config.json`with the following configuration:
384
+
1.Create a file that's named `jwt-config.json`that has the following configuration:
385
385
386
386
```json
387
387
{
@@ -420,7 +420,7 @@ Create a file named `jwt-config.json` with the following configuration:
420
420
421
421
::: zone-end
422
422
423
-
Then update the authenticator.
423
+
1. Update the authenticator:
424
424
425
425
```azurecli-interactive
426
426
az aks jwtauthenticator update \
@@ -438,13 +438,13 @@ To get more detailed information about authentication failures:
438
438
439
439
1. Enable diagnostic settings on your AKS cluster.
440
440
2. Configure the Log Analytics workspace to capture `Kubernetes API Server` logs.
441
-
3. Check API server logs for any JWT authenticator-related issue like incorrect claim mappings leading to validation errors.
441
+
3. Check API server logs for any JWT authenticator-related issue such as incorrect claim mappings that cause validation errors.
442
442
443
443
### Resources
444
444
445
-
-[jwt.ms site](https://jwt.ms)
446
-
-[Supported resource logs for Microsoft.ContainerService/managedClusters](/azure/aks/monitor-aks-reference#supported-resource-logs-for-microsoftcontainerservicemanagedclusters)
445
+
[jwt.ms site](https://jwt.ms)
446
+
[Supported resource logs for Microsoft.ContainerService/managedClusters](/azure/aks/monitor-aks-reference#supported-resource-logs-for-microsoftcontainerservicemanagedclusters)
447
447
448
448
[!INCLUDE [Azure Help Support](~/includes/azure-help-support.md)]
0 commit comments