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: articles/service-connector/how-to-use-service-connector-in-aks.md
+55-41Lines changed: 55 additions & 41 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,69 +1,71 @@
1
1
---
2
-
title: How Service Connector helps Azure Kubernetes Service (AKS) connect to other Azure services
3
-
description: Learn how to use Service Connector in Azure Kubernetes Service (AKS).
2
+
title: Use Service Connector in Azure Kubernetes Service (AKS)
3
+
description: Learn how to use Service Connector to connect AKS to other Azure services. Learn about Service Connector operations, resource management, and troubleshooting.
4
4
author: houk-ms
5
5
ms.service: service-connector
6
6
ms.topic: conceptual
7
-
ms.date: 03/01/2024
7
+
ms.date: 02/06/2025
8
8
ms.author: honc
9
9
---
10
+
10
11
# How to use Service Connector in Azure Kubernetes Service (AKS)
11
12
12
-
Azure Kubernetes Service (AKS) is one of the compute services supported by Service Connector. This article aims to help you understand:
13
+
Azure Kubernetes Service (AKS) is one of the compute services supported by Service Connector.
14
+
This article aims to help you understand:
13
15
14
16
* What operations are made on the cluster when creating a service connection.
15
-
* How to use the kubernetes resources Service Connector creates.
16
-
* How to troubleshoot and view logs of Service Connector in an AKS cluster.
17
+
* How to use the Kubernetes resources created by Service Connector.
18
+
* How to troubleshoot and view Service Connector logs in an AKS cluster.
17
19
18
20
## Prerequisites
19
21
20
22
* This guide assumes that you already know the [basic concepts of Service Connector](concept-service-connector-internals.md).
21
23
22
-
## What operations Service Connector makes on the cluster
24
+
## Learn about operations performed by Service Connector on the AKS cluster
23
25
24
26
Depending on the different target services and authentication types selected when creating a service connection, Service Connector makes different operations on the AKS cluster. The following lists the possible operations made by Service Connector.
25
27
26
-
### Add the Service Connector kubernetes extension
28
+
### Adding the Service Connector Kubernetes extension
27
29
28
-
A kubernetes extension named `sc-extension` is added to the cluster the first time a service connection is created. Later on, the extension helps create kubernetes resources in user's cluster, whenever a service connection request comes to Service Connector. You can find the extension in your AKS cluster in the Azure portal, in the **Extensions + applications** menu.
30
+
A Kubernetes extension named `sc-extension` is added to the cluster the first time a service connection is created. Later on, the extension helps create Kubernetes resources in user's cluster, whenever a service connection request comes to Service Connector. You can find the extension in your AKS cluster in the Azure portal, in the **Extensions + applications** menu.
29
31
30
32
:::image type="content" source="./media/aks-tutorial/sc-extension.png" alt-text="Screenshot of the Azure portal, view AKS extension.":::
31
33
32
34
The extension is also where the cluster connections metadata are stored. Uninstalling the extension makes all the connections in the cluster unavailable. The extension operator is hosted in the cluster namespace `sc-system`.
33
35
34
-
### Create kubernetes resources
36
+
### Creating the Kubernetes resources
35
37
36
-
Service Connector creates some kubernetes resources to the namespace the user specified when creating a service connection. The kubernetes resources store the connection information, which is needed by the user's workload definitions or application code to talk to target services. Depending on different authentication types, different kubernetes resources are created. For the `Connection String` and `Service Principal` auth types, a kubernetes secret is created. For the `Workload Identity` auth type, a kubernetes service account is also created in addition to a kubernetes secret.
38
+
Service Connector creates some Kubernetes resources to the namespace the user specified when creating a service connection. The Kubernetes resources store the connection information, which is needed by the user's workload definitions or application code to talk to target services. Depending on different authentication types, different Kubernetes resources are created. For the `Connection String` and `Service Principal` auth types, a Kubernetes secret is created. For the `Workload Identity` auth type, a Kubernetes service account is also created in addition to a Kubernetes secret.
37
39
38
-
You can find the kubernetes resources created by Service Connector for each service connection on the Azure portal in your kubernetes resource, in the Service Connector menu.
40
+
You can find the Kubernetes resources created by Service Connector for each service connection on the Azure portal in your Kubernetes resource, in the Service Connector menu.
39
41
40
-
:::image type="content" source="./media/aks-tutorial/kubernetes-resources.png" alt-text="Screenshot of the Azure portal, view Service Connector created kubernetes resources.":::
42
+
:::image type="content" source="./media/aks-tutorial/kubernetes-resources.png" alt-text="Screenshot of the Azure portal, view Service Connector created Kubernetes resources.":::
41
43
42
44
Deleting a service connection doesn't delete the associated Kubernetes resource. If necessary, remove your resource manually, using for example the kubectl delete command.
43
45
44
-
### Enable the `azureKeyvaultSecretsProvider`addon
46
+
### Enabling the `azureKeyvaultSecretsProvider`add-on
45
47
46
48
If target service is Azure Key Vault and the Secret Store CSI Driver is enabled when creating a service connection, Service Connector enables the `azureKeyvaultSecretsProvider` add-on for the cluster.
47
49
48
50
:::image type="content" source="./media/aks-tutorial/keyvault-csi.png" alt-text="Screenshot of the Azure portal, enabling CSI driver for keyvault when creating a connection.":::
49
51
50
52
Follow the [Connect to Azure Key Vault using CSI driver tutorial](./tutorial-python-aks-keyvault-csi-driver.md)to set up a connection to Azure Key Vault using Secret Store CSI driver.
51
53
52
-
### Enable workload identity and OpenID Connect (OIDC) issuer
54
+
### Enabling workload identity and OpenID Connect (OIDC) issuer
53
55
54
56
If the authentication type is `Workload Identity` when creating a service connection, Service Connector enables workload identity and OIDC issuer for the cluster.
55
57
56
58
:::image type="content" source="./media/aks-tutorial/workload-identity.png" alt-text="Screenshot of the Azure portal, using workload identity to create a connection.":::
57
59
58
60
When the authentication type is `Workload Identity`, a user-assigned managed identity is needed to create the federated identity credential. Learn more from [what are workload identities](/entra/workload-id/workload-identities-overview), or follow the [tutorial](./tutorial-python-aks-storage-workload-identity.md)to set up a connection to Azure Storage using workload identity.
59
61
60
-
## How to use the Service Connector created kubernetes resources
62
+
## Use the Kubernetes resources created by Service Connector
61
63
62
-
Different kubernetes resources are created when the target service type and authentication type are different. The following sections show how to use the Service Connector created kubernetes resources in your cluster workloads definition and application codes.
64
+
Various Kubernetes resources are created by Service Connector depending on the target service type and authentication type. The following sections show how to use the Service Connector created Kubernetes resources in your cluster workloads definition and application codes.
63
65
64
-
####Kubernetes secret
66
+
### Kubernetes secret
65
67
66
-
A kubernetes secret is created when the authentication type is `Connection String` or `Service Principal`. Your cluster workload definition can reference the secret directly. The following snippet is an example.
68
+
A Kubernetes secret is created when the authentication type is `Connection String` or `Service Principal`. Your cluster workload definition can reference the secret directly. The following snippet is an example.
67
69
68
70
```yaml
69
71
apiVersion: batch/v1
@@ -87,9 +89,9 @@ spec:
87
89
88
90
Then, your application codes can consume the connection string in the secret from environment variable. You can check the [sample code](./how-to-integrate-storage-blob.md) to learn more about the environment variable names and how to use them in your application codes to authenticate to different target services.
89
91
90
-
####Kubernetes service account
92
+
### Kubernetes service account
91
93
92
-
Both a kubernetes service account and a secret are created when the authentication type is `Workload Identity`. Your cluster workload definition can reference the service account and secret to authenticate through workload identity. The following snippet provides an example.
94
+
Both a Kubernetes service account and a secret are created when the authentication type is `Workload Identity`. Your cluster workload definition can reference the service account and secret to authenticate through workload identity. The following snippet provides an example.
93
95
94
96
```yaml
95
97
apiVersion: batch/v1
@@ -115,13 +117,13 @@ spec:
115
117
116
118
You may check the tutorial to learn [how to connect to Azure Storage using workload identity](tutorial-python-aks-storage-workload-identity.md).
117
119
118
-
## How to troubleshoot and view logs
120
+
## Troubleshoot and view logs
119
121
120
122
If an error happens and couldn't be mitigated by retrying when creating a service connection, the following methods can help gather more information for troubleshooting.
121
123
122
-
### Check Service Connector kubernetes extension
124
+
### Check Service Connector Kubernetes extension
123
125
124
-
Service Connector kubernetes extension is built on top of [Azure Arc-enabled Kubernetes cluster extensions](/azure/azure-arc/kubernetes/extensions). Use the following commands to investigate if there are any errors during the extension installation or updating.
126
+
Service Connector Kubernetes extension is built on top of [Azure Arc-enabled Kubernetes cluster extensions](/azure/azure-arc/kubernetes/extensions). Use the following commands to investigate if there are any errors during the extension installation or updating.
125
127
126
128
1. Install the `k8s-extension` Azure CLI extension.
127
129
@@ -139,9 +141,9 @@ Service Connector kubernetes extension is built on top of [Azure Arc-enabled Kub
139
141
--name sc-extension
140
142
```
141
143
142
-
### Check kubernetes cluster logs
144
+
### Check Kubernetes cluster logs
143
145
144
-
If there's an error during the extension installation, and the error message in the `statuses` property doesn't provide enough information about what happened, you can further check the kubernetes logs with the followings steps.
146
+
If there's an error during the extension installation, and the error message in the `statuses` property doesn't provide enough information about what happened, you can further check the Kubernetes logs with the followings steps.
145
147
146
148
1. Connect to your AKS cluster.
147
149
@@ -163,7 +165,7 @@ If there's an error during the extension installation, and the error message in
163
165
```Bash
164
166
helm list -n sc-system
165
167
```
166
-
1. During the extension installation or updating, a kubernetes job called `sc-job` creates the kubernetes resources for the service connection. The job execution failure usually causes the extension failure. Check the job status by running the following commands. If `sc-job` doesn't exist in `sc-system` namespace, it should have been executed successfully. This job is designed to be automatically deleted after successful execution.
168
+
1. During the extension installation or updating, a Kubernetes job called `sc-job` creates the Kubernetes resources for the service connection. The job execution failure usually causes the extension failure. Check the job status by running the following commands. If `sc-job` doesn't exist in `sc-system` namespace, it should have been executed successfully. This job is designed to be automatically deleted after successful execution.
167
169
168
170
- Check the job exists.
169
171
@@ -185,73 +187,85 @@ If there's an error during the extension installation, and the error message in
185
187
186
188
### Common errors and mitigations
187
189
188
-
#### Extension creation errors
190
+
#### Extension creation error
191
+
192
+
**Error message:**
189
193
190
-
**Error Message:**
191
194
`Unable to get a response from the agent in time`.
192
195
193
196
**Mitigation:**
197
+
194
198
Refer to [extension creation errors](/troubleshoot/azure/azure-kubernetes/extensions/cluster-extension-deployment-errors#extension-creation-errors)
195
199
196
200
197
201
#### Helm errors
198
202
199
-
**Error Message:**
203
+
**Error messages:**
204
+
200
205
- `Timed out waiting for resource readiness`
201
206
- `Unable to download the Helm chart from the repo URL`
202
207
- `Helm chart rendering failed with given values`
203
208
- `Resource already exists in your cluster`
204
209
- `Operation is already in progress for Helm`
205
210
206
211
**Mitigation:**
212
+
207
213
Refer to [Helm errors](/troubleshoot/azure/azure-kubernetes/extensions/cluster-extension-deployment-errors#helm-errors)
208
214
209
215
210
216
#### Conflict
211
217
212
-
**Error Message:**
218
+
**Error message:**
219
+
213
220
`Operation returned an invalid status code: Conflict`.
214
221
215
222
**Reason:**
216
-
This error usually occurs when attempting to create a service connection while the AKS (Azure Kubernetes Service) cluster is in an updating state. The service connection update conflicts with the ongoing update. It could also happen when your subscription is not registered for the `Microsoft.KubernetesConfiguration` resource provider.
223
+
224
+
This error usually occurs when attempting to create a service connection while the Azure Kubernetes Service (AKS) cluster is in an updating state. The service connection update conflicts with the ongoing update. This error also occurs when your subscription is not registered with the `Microsoft.KubernetesConfiguration` resource provider.
217
225
218
226
**Mitigation:**
219
-
- Run the following command to make sure your subscription is registered for `Microsoft.KubernetesConfiguration` resource provider.
227
+
228
+
1. Ensure your cluster is in a "Succeeded" state and retry the creation.
229
+
1. Run the following command to make sure your subscription is registered with the `Microsoft.KubernetesConfiguration` resource provider.
220
230
221
231
```azurecli
222
232
az provider register -n Microsoft.KubernetesConfiguration
223
233
```
224
-
- Ensure your cluster is in a "Succeeded" state and retry the creation.
225
-
226
234
227
235
#### Unauthorized resource access
228
236
229
-
**Error Message:**
237
+
**Error message:**
238
+
230
239
`You do not have permission to perform ... If access was recently granted, please refresh your credentials`.
231
240
232
241
**Reason:**
242
+
233
243
Service Connector requires permissions to operate the Azure resources you want to connect to, in order to perform connection operations on your behalf. This error indicates a lack of necessary permissions on some Azure resources.
234
244
235
245
**Mitigation:**
236
-
Check the permissions on the Azure resources specified in the error message. Obtain the required permissions and retry the creation.
237
246
247
+
Check the permissions on the Azure resources specified in the error message. Obtain the required permissions and retry the creation.
238
248
239
249
#### Missing subscription registration
240
-
**Error Message:**
250
+
251
+
**Error message:**
252
+
241
253
`The subscription is not registered to use namespace 'Microsoft.KubernetesConfiguration'`
242
254
243
255
**Reason:**
244
-
Service Connector requires the subscription to be registered for `Microsoft.KubernetesConfiguration`, which is the resource provider for [Azure Arc-enabled Kubernetes cluster extensions](/azure/azure-arc/kubernetes/extensions).
256
+
257
+
Service Connector requires the subscription to be registered with `Microsoft.KubernetesConfiguration`, which is the resource provider for [Azure Arc-enabled Kubernetes cluster extensions](/azure/azure-arc/kubernetes/extensions).
245
258
246
259
**Mitigation:**
247
-
Register the `Microsoft.KubernetesConfiguration` resource provider by running the following command. For more information on resource provider registration errors, please refer to this [tutorial](../azure-resource-manager/troubleshooting/error-register-resource-provider.md).
260
+
261
+
Register the `Microsoft.KubernetesConfiguration` resource provider by running the following command. For more information on resource provider registration errors, please refer to [Resolve errors for resource provider registration](../azure-resource-manager/troubleshooting/error-register-resource-provider.md).
248
262
249
263
```azurecli
250
264
az provider register -n Microsoft.KubernetesConfiguration
251
265
```
252
266
253
267
254
-
## Next steps
268
+
## Next step
255
269
256
270
Learn how to integrate different target services and read about their configuration settings and authentication methods.
0 commit comments