Skip to content

Commit 1523d19

Browse files
authored
Merge pull request #277479 from alt-key/patch-4
Update diagnose-connection-issues.md
2 parents 7acdcf7 + 2741bc2 commit 1523d19

File tree

1 file changed

+129
-0
lines changed

1 file changed

+129
-0
lines changed

articles/azure-arc/kubernetes/diagnose-connection-issues.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,135 @@ az connectedk8s connect --name <cluster-name> --resource-group <resource-group>
123123

124124
If everything is working correctly, your pods should all be in the `Running` state. Run `kubectl get pods -n azure-arc` to confirm whether any pod's state is not `Running`.
125125

126+
127+
### Check whether the DNS resolution is successful for the endpoint
128+
129+
From within the pod, you can run a DNS lookup to the endpoint.
130+
131+
What if you can't run the [kubectl exec](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#exec) command to connect to the pod and install the DNS Utils package? In this situation, you can [start a test pod in the same namespace as the problematic pod](https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/#create-a-simple-pod-to-use-as-a-test-environment), and then run the tests.
132+
133+
> [!NOTE]
134+
>
135+
> If the DNS resolution or egress traffic doesn't let you install the necessary network packages, you can use the `rishasi/ubuntu-netutil:1.0` docker image. In this image, the required packages are already installed.
136+
137+
Here's an example procedure for checking DNS resolution:
138+
139+
1. Start a test pod in the same namespace as the problematic pod:
140+
141+
```bash
142+
kubectl run -it --rm test-pod --namespace <namespace> --image=debian:stable
143+
```
144+
145+
After the test pod is running, you'll gain access to the pod.
146+
147+
1. Run the following `apt-get` commands to install other tool packages:
148+
149+
```bash
150+
apt-get update -y
151+
apt-get install dnsutils -y
152+
apt-get install curl -y
153+
apt-get install netcat -y
154+
```
155+
156+
1. After the packages are installed, run the [nslookup](/windows-server/administration/windows-commands/nslookup) command to test the DNS resolution to the endpoint:
157+
158+
```console
159+
$ nslookup microsoft.com
160+
Server: 10.0.0.10
161+
Address: 10.0.0.10#53
162+
...
163+
...
164+
Name: microsoft.com
165+
Address: 20.53.203.50
166+
```
167+
168+
1. Try the DNS resolution from the upstream DNS server directly. This example uses Azure DNS:
169+
170+
```console
171+
$ nslookup microsoft.com 168.63.129.16
172+
Server: 168.63.129.16
173+
Address: 168.63.129.16#53
174+
...
175+
...
176+
Address: 20.81.111.85
177+
```
178+
179+
1. Run the `host` command to check whether the DNS requests are routed to the upstream server:
180+
181+
```console
182+
$ host -a microsoft.com
183+
Trying "microsoft.com.default.svc.cluster.local"
184+
Trying "microsoft.com.svc.cluster.local"
185+
Trying "microsoft.com.cluster.local"
186+
Trying "microsoft.com.00idcnmrrm4edot5s2or1onxsc.bx.internal.cloudapp.net"
187+
Trying "microsoft.com"
188+
Trying "microsoft.com"
189+
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62884
190+
;; flags: qr rd ra; QUERY: 1, ANSWER: 27, AUTHORITY: 0, ADDITIONAL: 5
191+
192+
;; QUESTION SECTION:
193+
;microsoft.com. IN ANY
194+
195+
;; ANSWER SECTION:
196+
microsoft.com. 30 IN NS ns1-39.azure-dns.com.
197+
...
198+
...
199+
ns4-39.azure-dns.info. 30 IN A 13.107.206.39
200+
201+
Received 2121 bytes from 10.0.0.10#53 in 232 ms
202+
```
203+
204+
1. Run a test pod in the Windows node pool:
205+
206+
```bash
207+
# For a Windows environment, use the Resolve-DnsName cmdlet.
208+
kubectl run dnsutil-win --image='mcr.microsoft.com/windows/servercore:1809' --overrides='{"spec": { "nodeSelector": {"kubernetes.io/os": "windows"}}}' -- powershell "Start-Sleep -s 3600"
209+
```
210+
211+
1. Run the [kubectl exec](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#exec) command to connect to the pod by using PowerShell:
212+
213+
```bash
214+
kubectl exec -it dnsutil-win powershell
215+
```
216+
217+
1. Run the [Resolve-DnsName](/powershell/module/dnsclient/resolve-dnsname) cmdlet in PowerShell to check whether the DNS resolution is working for the endpoint:
218+
219+
```console
220+
PS C:\> Resolve-DnsName www.microsoft.com
221+
222+
Name Type TTL Section NameHost
223+
---- ---- --- ------- --------
224+
www.microsoft.com CNAME 20 Answer www.microsoft.com-c-3.edgekey.net
225+
www.microsoft.com-c-3.edgekey. CNAME 20 Answer www.microsoft.com-c-3.edgekey.net.globalredir.akadns.net
226+
net
227+
www.microsoft.com-c-3.edgekey. CNAME 20 Answer e13678.dscb.akamaiedge.net
228+
net.globalredir.akadns.net
229+
230+
Name : e13678.dscb.akamaiedge.net
231+
QueryType : AAAA
232+
TTL : 20
233+
Section : Answer
234+
IP6Address : 2600:1408:c400:484::356e
235+
236+
237+
Name : e13678.dscb.akamaiedge.net
238+
QueryType : AAAA
239+
TTL : 20
240+
Section : Answer
241+
IP6Address : 2600:1408:c400:496::356e
242+
243+
244+
Name : e13678.dscb.akamaiedge.net
245+
QueryType : A
246+
TTL : 12
247+
Section : Answer
248+
IP4Address : 23.200.197.152
249+
```
250+
251+
If the DNS resolution is not successful, verify the DNS configuration for the cluster.
252+
253+
254+
126255
### Still having problems?
127256

128257
The steps above will resolve many common connection issues, but if you're still unable to connect successfully, generate a troubleshooting log file and then [open a support request](../../azure-portal/supportability/how-to-create-azure-support-request.md) so we can investigate the problem further.

0 commit comments

Comments
 (0)