{
  "id": "kubernetes/port-forward-connection-refused",
  "signature": "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]",
  "signature_zh": "E: 无法在端口 8080 上监听：监听器创建失败，错误信息：[无法创建监听器：错误监听 tcp4 127.0.0.1:8080：绑定：地址已在使用中]",
  "regex": "Unable to listen on port \\d+: Listeners failed to create with the following errors: \\[unable to create listener: Error listen tcp4 .* bind: address already in use\\]",
  "domain": "kubernetes",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Local port (e.g., 8080) is already occupied by another process, preventing kubectl port-forward from binding.",
  "root_cause_type": "generic",
  "root_cause_zh": "本地端口（例如 8080）已被其他进程占用，阻止了 kubectl port-forward 的绑定。",
  "versions": [
    {
      "version": "kubernetes 1.25",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "kubectl 1.26",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "kubectl 1.27",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Restarting the command doesn't release the port; the local process still holds it.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "If the new port is also in use, the same error occurs. Requires manual verification.",
      "fail_rate": 0.3,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Elevated privileges don't free the port; the underlying socket is still bound.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "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`.",
      "success_rate": 0.95,
      "how": "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`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "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`.",
      "success_rate": 0.9,
      "how": "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`.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "识别占用端口（例如 8080）的进程并终止：`lsof -i :8080` 然后 `kill -9 <PID>`。或者使用 `fuser -k 8080/tcp`。",
    "使用未被占用的不同本地端口：`kubectl port-forward pod/my-pod 9090:80`（将本地 9090 映射到 pod 的 80）。使用 `netstat -tuln | grep 9090` 验证。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.92,
  "resolvable": "true",
  "first_seen": "2023-03-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}