Port-forwarding to service not working on 0.12.49 ...
# 🌱|help-and-getting-started
Hi everyone, I'm experiencing port-forwarding issues on garden 0.12.49 and above (we are not ready to upgradeto Bonsai yet). On 0.12.48 I can run a simple
mysql -u root -h -p
and successfully connect to my database. On 0.12.49 and above that command results in this error
ERROR 2003 (HY000): Can't connect to MySQL server on '' (61)
I started garden in silly debug mode on each version. When connecting to mysql on 0.12.48 I see the following output from garden
Copy code
ℹ mysql [debug]             → Starting port forward to mysql/mysql:3306
ℹ mysql [silly]             → Getting getPortForward handler for service mysql
ℹ mysql [silly]             → Calling getPortForward handler for service mysql
ℹ mysql [debug]             → Forwarding local port 63925 to Service/mysql port 3306
ℹ mysql [silly]             → Running 'kubectl --context=docker-desktop --namespace=localhost-demo port-forward Service/mysql 63925:3306'
ℹ mysql [silly]             → [Service/mysql port forwarder] Forwarding from -> 3306

ℹ mysql [debug]             → Successfully started port forward to mysql/mysql:3306
ℹ mysql [debug]             → Connecting to mysql/mysql:3306 port forward at localhost:63925
On 0.12.49 I get no output. However, I am able to connect on 0.12.49 and above if I use the following command
mysql -u root -h localhost --protocol=tcp -p
. The same command with
as the host results in the error mentioned above. I have create a simple garden project with a mysql 8 database at https://github.com/ultimatemonty/garden-localhost-port-forwarding-repro that can be used to test. The repo includes the yaml output for my project resources as well as all resources in the garden-system namespace for 0.12.48 and 0.12.49. A cursory diff of the resources didn't reveal anything interesting - mostly metadata changes. I also looked over the diff from 0.12.48 to 0.12.49 (https://github.com/garden-io/garden/compare/0.12.48...0.12.49?diff=split) and nothing stood out as a potentially suspicious change. This seems similar to https://discord.com/channels/817392104711651328/1065773860328325140/1065773860328325140.
this is not just a MySQL issue. My users are also experiencing the issue when trying to perform remote debugging on a java project.
kubectl port-forward
works for them but is definitely not ideal
update: I was able to use the
environment variable to fix the issue per https://github.com/garden-io/garden/pull/3690