kubectl port-forward bind: address already in use unable

前言

本地的 8080 映射到 Pod 的 80,kubectl 会把这个端口的所有数据都转发给集群内部的 Pod

复制代码
kubectl port-forward wp-pod 8080:80 &

在命令的末尾使用了一个 & 符号,让端口转发工作在后台进行

发生报错:

复制代码
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 unable to create listener: Error listen tcp6 [::1]:8080: bind: address already in use]
error: unable to listen on any of the requested ports: [{8080 80}]

这是因为 kubectl 没有释放其端口绑定,你可以通过以下命令手动终止 pid(示例基于尝试向前运行8080端口)

复制代码
lsof -i :8080

获得 pid 后,你可以通过标准的 kill-9 12345 将其杀死

posted @   牛奔  阅读(112)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
点击右上角即可分享
微信分享提示