how to undo a kubectl port-forward
The port is only forwarded while the kubectl process is running, so you can just kill the kubectl process that's forwarding the port. In most cases that'll just mean pressing CTRL+C in the terminal where the port-forward command is running.
If it was launch in the background you can use the fg
command to access it and then use ctrl + C