kubernetes / kubernetes/kubectl
port-forward dropping the connection for certain type of files
- Dominant language
- Go
- Stars
- 3.3k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
We are seeing a problem where `kubectl port-forward` is dropping the connection after serving a particular type of file, in this case a video, strangely enough, when we serve videos from non static files (copying a stream of bytes from MinIO for example) the pipe never breaks, file size makes no difference.
I created a repo with a reproduction case at https://github.com/dvaldivia/gofileserve
Steps to reproduction
## 1. Deploy the app in your kubernetes cluster
```shell
kubectl apply -f kubernetes/deployment.yaml
```
## 2. Port Forward to this service
```shell
kubectl port-forward svc/gofileserve 4001:4000
```
## 3. On another terminal, try to get `Spinning-Cat.mp4`
```shell
curl http://localhost:4001/assets/media/Spinning-Cat.mp4
```
You'll see how the port-forward breaks, and no request will work afterwards
```shell
➜ kubectl port-forward svc/gofileserve 4001:4000
Forwarding from 127.0.0.1:4001 -> 4000
Forwarding from [::1]:4001 -> 4000
Handling connection for 4001
E0210 13:22:27.776615 61159 portforward.go:379] error copying from remote stream to local connection: readfrom tcp4 127.0.0.1:4001->127.0.0.1:52390: write tcp4 127.0.0.1:4001->127.0.0.1:52390: write: broken pipe
```
if you restart the port-forward and you try to get other static files, like `hello.json` the pipe will never break
```shell
➜ curl http://localhost:4001/assets/hello.json
{
"hello": "world"
}
```
So for this particular type of file being returned something cracks inside `kubectl port-forward`
Contributor guide
Assessment
This issue has not been assessed yet.