I am running a k8s cluster on bare-metal RHEL7. I am trying to run the kubectl port-forward command and am getting a error.
kubectl port-forward -p somepod 10000:8080
I0128 15:33:33.802226 70558 portforward.go:225] Forwarding from 127.0.0.1:10000 -> 8080
E0128 15:33:33.802334 70558 portforward.go:214] Unable to create listener: Error listen tcp6 [::1]:10000: bind: cannot assign requested address
Any ideas why this could be happening?
If you run kubectl port-forward multiple times, and you have ipv6 enabled on your machine you will run on this quite often.
There are two solutions:
Permanent solution: disable ipv6
echo "
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6=1
" | sudo tee -a /etc/sysctl.conf reboot"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With