# Kubernetes tip 2: Connectivity troubleshooting

When pod-to-pod connectivity fails in Kubernetes, the first thing I do is test from inside the source pod. When you don't have the easy tools like wget or curl, fall back to the basics.

My approach: Start with easy tools first, then fall back to bash basics.

**1. First try: curl**

```bash
curl -s http://localhost:8080/hc
```

**2. Then try: nc -vz for port check (if curl missing)**

```bash
nc -vz localhost 8080
```

**3. Then try: wget**

```bash
wget -q -O /dev/null --spider http://localhost:8080/hc && echo "OK" || echo "Failed"
```

**4. Fall back: bash /dev/tcp port check**

```bash
cat < /dev/null > /dev/tcp/8.8.8.8/53; echo $?
```

Returns 0 if open, non-zero if blocked. Works in any bash container — no external tools needed.

**5. Fall back: HTTP GET with cat**

```bash
exec 3<>/dev/tcp/localhost/8080
echo -e 'GET /hc HTTP/1.1\r\nUser-Agent: bash\r\nAccept: */*\r\nhost: localhost\r\nConnection: Keep-Alive\r\n\r\n' >&3
cat <&3
```

Raw HTTP request using just bash redirection.

**6. PowerShell/.NET (for Windows containers)**

```powershell
(New-Object System.Net.Sockets.TcpClient("20.73.131.39", 9003)).GetStream().Write(@(0x30, 0x31), 0, 1)
```

Why /dev/tcp works: Bash's special file that opens TCP connections, perfect for minimal containers without networking tools.

I saved these over time. curl → wget → /dev/tcp is my go-to sequence. What's yours?

![Raw HTTP request via bash /dev/tcp screenshot](https://images.koorevaar.com/linkedin-import/aks-connectivity-troubleshooting-tip-2.jpg)

---

*Co-authored with Claude.*

If this was useful, [you can buy me a coffee](https://ko-fi.com/p47k0).

New articles: [follow via RSS](https://blog.koorevaar.com/feed.xml).
