<p>So, i am trying to connect to my scylla instance in GKE with cqlsh by opening a connection with Kubectl. I am however stumbling into some wierd issues i cannot get my head around.</p>

<p>I am running scylla on GKE, it is basicly a cassandra knockoff that is supossed to run way faster than cassandra itself.
To access scylla, i want to be able to connect to the db with the kubectl port-forward command so i can hook up external tools such as table plus.
When i run <code>kubectl port-forward pod/scylla-0 -n scylla 9042</code> i expect the port to be accessible from my local machine, however, when i try to connect with cqlsh localy i get these error messages:</p>

<pre><code>from clqsh: Connection error: ('Unable to connect to any servers', {'127.0.0.1': ConnectionShutdown('Connection to 127.0.0.1 was closed',)})

from kubectl: E0520 17:12:12.522329      51 portforward.go:400] an error occurred forwarding 9042 -&gt; 9042: error forwarding port 9042 to pod &lt;some id&gt;, uid : exit status 1: 2019/05/20 15:12:12 socat[998972] E connect(5, AF=2 127.0.0.1:9042, 16): Connection refused
</code></pre>

<p>i've also tried to forward the service directly to similar results</p>

<p>What i personaly believe is the wierd part of this is that when i expose scylla with a loadbalancer, i can connect to it perfectly fine, i can also use JConsole when i forward the JMX port for scylla, which is why i am having so many headaches over this.</p>

<p>The reason it is failing is because port-forward only binds to localhost (127.0.0.1). If you go inside the pod with </p>

<pre><code>kubectl exec -ti pod/scylla-0 -n scylla -- /bin/bash
yum install net-tools -y
netstat -nlup | grep scylla 
</code></pre>

<p>You will notice that scylla is binding to the container pod IP and not 127.0.0.1 so you get a connection refused.</p>

<p>Try:
<code>kubectl port-forward --address your_pod_ip pod/mypod 9042:9042</code></p>

<p>Alternatively:
<code>kubectl port-forward --address your_service_ip service/myservice 9042:9042</code></p>

<p>I didn't try it myself but I think it can work. Please let me know.</p>
