# E: Unable to listen on port 8080: Listeners failed to create with the following errors: [unable to create listener: Error listen tcp4 127.0.0.1:8080: bind: address already in use]

- **ID:** `kubernetes/port-forward-connection-refused`
- **Domain:** kubernetes
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 92%

## Root Cause

Local port (e.g., 8080) is already occupied by another process, preventing kubectl port-forward from binding.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| kubernetes 1.25 | active | — | — |
| kubectl 1.26 | active | — | — |
| kubectl 1.27 | active | — | — |

## Workarounds

1. **Identify the process using the port (e.g., 8080) and terminate it: `lsof -i :8080` then `kill -9 <PID>`. Alternatively, use `fuser -k 8080/tcp`.** (95% success)
   ```
   Identify the process using the port (e.g., 8080) and terminate it: `lsof -i :8080` then `kill -9 <PID>`. Alternatively, use `fuser -k 8080/tcp`.
   ```
2. **Use a different local port that is not in use: `kubectl port-forward pod/my-pod 9090:80` (maps local 9090 to pod's 80). Verify with `netstat -tuln | grep 9090`.** (90% success)
   ```
   Use a different local port that is not in use: `kubectl port-forward pod/my-pod 9090:80` (maps local 9090 to pod's 80). Verify with `netstat -tuln | grep 9090`.
   ```

## Dead Ends

- **** — Restarting the command doesn't release the port; the local process still holds it. (95% fail)
- **** — If the new port is also in use, the same error occurs. Requires manual verification. (30% fail)
- **** — Elevated privileges don't free the port; the underlying socket is still bound. (90% fail)
