YugaByte DB Community Forum

Access k8 Cluster on Windows from another machine


My setup is as follows

I have a Windows 10 Server. I’ve installed the MiniKube and got the Yugabyte cluster running on the Windows server. I want to be able to access the cluster, and in particular the Postgres Proxy from a second windows machine. This is my first time using k8 and I’m stuck on how to do this. It looks like I need to do something similar to this



I’m looking into this and will have an answer for you on Monday.



You need to add a LoadBalancer for the yb-tservers service as well as starting up the minikube tunnel service on Windows 10 Server.

Add this to your yugabyte-statefulset.yaml:

apiVersion: v1
kind: Service
  name: yb-tservers-service
    app: yb-tserver
  - name: ui
    port: 9000
  - name: rpc-port
    port: 9100
  - name: postgres
    port: 5433
  - name: cassandra
    port: 9042
  - name: redis
    port: 6379
    app: yb-tserver
  type: LoadBalancer

Remember to uncomment the two lines for enabling Postgres support in YugaByte CE as noted here: https://docs.yugabyte.com/latest/quick-start/test-postgresql/#kubernetes

After you create the new statefulset you will see the new service:

    PS C:\Users\acald\yugabyte> kubectl get svc
    NAME                  TYPE           CLUSTER-IP       EXTERNAL-IP      PORT(S)                                                                      AGE
    kubernetes            ClusterIP        <none>           443/TCP                                                                      27m
    yb-master-ui          LoadBalancer   7000:31598/TCP                                                               26m
    yb-masters            ClusterIP      None             <none>           7000/TCP,7100/TCP                                                            26m
    yb-tservers           ClusterIP      None             <none>           9000/TCP,9100/TCP,9042/TCP,6379/TCP,5433/TCP                                 26m
    yb-tservers-service   LoadBalancer     9000:30478/TCP,9100:30923/TCP,5433:31730/TCP,9042:31119/TCP,6379:30304/TCP   26m

It may show the EXTERNAL-IP as . In that case, execute minikube tunnel from your PowerShell prompt to activate the tunnel service.

Finally, you can see a list of the endpoints with the following:
minikube service yb-tservers-service --url

It looks like the following:

PS C:\Users\acald\yugabyte> minikube service yb-tservers-service --url

Since you are looking to connect to Postgres you can connect on port 31730 and the IP address noted in the output above.

Hope this helps. Let us know if you encounter further issues or have additional questions.




Thanks for this. Giving it a shot now…



Here’s what I get…

C:\Users\Mark D Drake\VirtualBox VMs\Yugabyte>kubectl get svc
NAME                  TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)                                                                      AGE
kubernetes            ClusterIP       <none>        443/TCP                                                                      7d5h
yb-master-ui          LoadBalancer   <pending>     7000:32107/TCP                                                               2m21s
yb-masters            ClusterIP      None            <none>        7000/TCP,7100/TCP                                                            2m21s
yb-tservers           ClusterIP      None            <none>        9000/TCP,9100/TCP,9042/TCP,6379/TCP                                          2m21s
yb-tservers-service   LoadBalancer   <pending>     9000:32634/TCP,9100:31856/TCP,5433:32458/TCP,9042:30016/TCP,6379:30459/TCP   2m21s

C:\Users\Mark D Drake\VirtualBox VMs\Yugabyte>minikube service yb-tservers-service --url

Sanity check connection to my local postgres instance…

C:\Users\Mark D Drake\VirtualBox VMs\Yugabyte>"c:\Program Files\PostgreSQL\11\bin\psql.exe" -U postgres -h -p 5432
psql (11beta2)
WARNING: Console code page (437) differs from Windows code page (1252)
         8-bit characters might not work correctly. See psql reference
         page "Notes for Windows users" for details.
Type "help" for help.

postgres=# exit

Attempt connection to Yugabyte cluster

C:\Users\Mark D Drake\VirtualBox VMs\Yugabyte>"c:\Program Files\PostgreSQL\11\bin\psql.exe" -U postgres -h -p 32458
psql: could not connect to server: Connection timed out (0x0000274C/10060)
        Is the server running on host "" and accepting
        TCP/IP connections on port 32458?

C:\Users\Mark D Drake\VirtualBox VMs\Yugabyte>

The connection to the cluster seems to time out.

Some thoughts…

Why is the external IP shown as <Pending> in the “kubectl get svc” output ?
Where does it get the IP address from…

The Hosts IP address is hard wired to
My DHCP server allocated addresses on 192.168.1…

Why does the miniube service --url show the ipaddress, do I need to force it on to 192.168.1 somehow ?


If you execute minikube ip that will give you the IP address of the minikube cluster. The fact that it is not on the same network as your host suggests that your VirtualBox networking configuration is not set up to share the host’s network and is using a “private” address instead. It may be set to something like Internal or DockerNAT currently. You want it get an address on the “External” network. See this link for a discussion on how to set this up with HyperV – and you will need to find the equivalent in VirtualBox: https://blogs.msdn.microsoft.com/wasimbloch/2017/01/23/setting-up-kubernetes-on-windows10-laptop-with-minikube/