Setting kube’s streaming-connection-idle-timeout to 0 should be a right solution, but if you don’t want to change anything, you can use while-do construction
Format: while true; do <<YOUR COMMAND HERE>>; done
So just inputing in CLI: while true; do kubectl --namespace somenamespace port-forward somepodname 50051:50051; done should keep kubectl reconnecting on connection lost