|
1 | 1 | --- |
2 | 2 | title: Client IP address can't access the API server |
3 | 3 | description: Troubleshoot issues caused when the client IP address can't access the API server on an Azure Kubernetes Service (AKS) cluster. |
4 | | -ms.date: 10/08/2024 |
5 | | -ms.reviewer: rissing, chiragpa, jaewonpark, v-leedennis, v-weizhu |
6 | | -ms.service: azure-kubernetes-service |
7 | | -#Customer intent: As an Azure Kubernetes user, I want the AKS API server to allow access to my client IP address so that I can successfully connect to my AKS cluster. |
8 | | -ms.custom: sap:Connectivity |
| 4 | +ms.topic: article |
| 5 | +ms.date: 06/11/2024 |
| 6 | +author: microsoftdocs |
| 7 | +ms.author: microsoftdocs |
| 8 | +ms.custom: sap:Connectivity, innovation-engine |
9 | 9 | --- |
| 10 | + |
10 | 11 | # Client IP address can't access the API server |
11 | 12 |
|
12 | 13 | This article describes how to fix issues that occur when you can't connect to an Azure Kubernetes Service (AKS) cluster because your client IP address can't access the AKS API server. |
@@ -47,8 +48,8 @@ Unable to connect to the server: dial tcp <API-SERVER-IP>:443: connectex: A conn |
47 | 48 | [API server-authorized IP ranges](/azure/aks/api-server-authorized-ip-ranges) may have been enabled on the cluster's API server, but the client's IP address wasn't included in the IP ranges. To check whether this feature has been enabled, see if the following [az aks show](/cli/azure/aks#az-aks-show) command in Azure CLI produces a list of IP ranges: |
48 | 49 |
|
49 | 50 | ```azurecli |
50 | | -az aks show --resource-group <cluster-resource-group> \ |
51 | | - --name <cluster-name> \ |
| 51 | +az aks show --resource-group ${RG_NAME} \ |
| 52 | + --name ${CLUSTER_NAME} \ |
52 | 53 | --query apiServerAccessProfile.authorizedIpRanges |
53 | 54 | ``` |
54 | 55 |
|
@@ -76,18 +77,46 @@ Look at the cluster's API server-authorized ranges, and add your client's IP add |
76 | 77 |
|
77 | 78 | 1. Get your client IP address by running this [curl](https://curl.se/docs/manpage.html) command: |
78 | 79 |
|
| 80 | + ```azurecli |
| 81 | + export CLIENT_IP=$(curl --silent https://ipinfo.io/ip | tr -d '\n') |
| 82 | + echo $CLIENT_IP |
| 83 | + ``` |
| 84 | +
|
| 85 | + Results: |
| 86 | +
|
| 87 | + <!-- expected_similarity=0.3 --> |
| 88 | +
|
79 | 89 | ```output |
80 | | - $ curl --silent checkip.dyndns.org |
81 | | - <html><head><title>Current IP Check</title></head><body>Current IP Address: 0.255.127.63</body></html> |
| 90 | + 0.255.127.63 |
82 | 91 | ``` |
83 | 92 |
|
84 | 93 | 2. Update the API server-authorized range with the [az aks update](/cli/azure/aks#az-aks-update) command in Azure CLI, using your client IP address: |
85 | 94 |
|
86 | 95 | ```azurecli |
87 | | - az aks update --resource-group <cluster-resource-group> \ |
88 | | - --name <cluster-name> \ |
89 | | - --api-server-authorized-ip-ranges <ip-ranges-that-include-your-client-ip-address> |
| 96 | + az aks update --resource-group $RG_NAME \ |
| 97 | + --name $CLUSTER_NAME \ |
| 98 | + --api-server-authorized-ip-ranges $CLIENT_IP |
90 | 99 | ``` |
| 100 | +
|
| 101 | + Results: |
| 102 | +
|
| 103 | + <!-- expected_similarity=0.3 --> |
| 104 | +
|
| 105 | + ```output |
| 106 | + { |
| 107 | + "apiServerAccessProfile": { |
| 108 | + "authorizedIpRanges": [ |
| 109 | + "0.255.127.63/32" |
| 110 | + ], |
| 111 | + ... |
| 112 | + }, |
| 113 | + ... |
| 114 | + "name": "aks-cluster-xxx", |
| 115 | + "resourceGroup": "aks-rg-xxx", |
| 116 | + ... |
| 117 | + } |
| 118 | + ``` |
| 119 | +
|
91 | 120 | --- |
92 | 121 |
|
93 | | -[!INCLUDE [Azure Help Support](../../../includes/azure-help-support.md)] |
| 122 | +[!INCLUDE [Azure Help Support](../../../includes/azure-help-support.md)] |
0 commit comments