【发布时间】:2021-11-21 04:54:06
【问题描述】:
kubectl port-forward 中的help 表示The forwarding session ends when the selected pod terminates, and rerun of the command is needed to resume forwarding.
虽然它不会在 pod 终止时自动重新连接,但命令也不会返回,只会挂起错误:
E0929 11:57:50.187945 62466 portforward.go:400] an error occurred forwarding 8000 -> 8080: error forwarding port 8080 to pod a1fe1d167955e1c345e0f8026c4efa70a84b9d46029037ebc5b69d9da5d30249, uid : network namespace for sandbox "a1fe1d167955e1c345e0f8026c4efa70a84b9d46029037ebc5b69d9da5d30249" is closed
Handling connection for 8000
E0929 12:02:44.505938 62466 portforward.go:400] an error occurred forwarding 8000 -> 8080: error forwarding port 8080 to pod a1fe1d167955e1c345e0f8026c4efa70a84b9d46029037ebc5b69d9da5d30249, uid : failed to find sandbox "a1fe1d167955e1c345e0f8026c4efa70a84b9d46029037ebc5b69d9da5d30249" in store: not found
我希望它返回,以便我可以处理此错误并制作将重新运行它的脚本。
有什么办法或解决方法吗?
【问题讨论】:
标签: bash shell kubernetes command-line-interface kubectl