During local development with Kubernetes/minikube, how should I connect to postgres database running on localhost?

前端 未结 4 1341
太阳男子
太阳男子 2021-01-02 02:24

I\'ve set up an application stack running on Google Kubernetes Engine + Google Cloud SQL. When developing locally, I would like my application to connect to a postgres datab

4条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-02 02:40

    K8s Native Approach

    I had similar issues with developing cloud-native software directly inside Kubernetes. We took a look at tools like Telepresence and Skaffold, too but they are hard to configure and very time-consuming.

    That's why I built the DevSpace CLI together with a colleague: https://github.com/covexo/devspace

    Feel free to take a look and try it out. It will solve issues like yours by allowing you to easily run all your workloads directly inside Kubernetes while still being able to program with your desktop tools (local terminal, IDE, git etc).

    Alternative: Minikube networking

    As you are using minikube, you should take a look as the answers to this question: Routing an internal Kubernetes IP address to the host system

    Alternative: Tunneling

    You could also use local tunneling with tools like ngrok: https://ngrok.com/ (simply start it locally and connect to your ngrok address from anywhere)

提交回复
热议问题