WolfDan

WolfDan

Phoenix Ecto, don't connect on kubernetes

Hello all!

Actually I’m getting this error on my kubernetes log:

2017-06-02T02:02:49.13752428Z 02:02:49.137 [error] Postgrex.Protocol (pid<0.1578.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (...:5432): timeout

I already check the secrets on Kubernetes, this error is not from authentication, the connection is not refused, there is any way to solve it?

Thanks for all you help!

Greetings!

EDIT: When I make a request to the server I get this error:

2017-06-02T02:09:51.417407254Z Request: GET /anime/1
2017-06-02T02:09:51.417410146Z ** (exit) an exception was raised:
2017-06-02T02:09:51.417413126Z ** (DBConnection.ConnectionError) connection not available because of disconnection
2017-06-02T02:09:51.417416219Z (db_connection) lib/db_connection.ex:926: DBConnection.checkout/2
2017-06-02T02:09:51.417421994Z (db_connection) lib/db_connection.ex:742: DBConnection.run/3
2017-06-02T02:09:51.417425202Z (db_connection) lib/db_connection.ex:584: DBConnection.prepare_execute/4
2017-06-02T02:09:51.417429314Z (ecto) lib/ecto/adapters/postgres/connection.ex:80: Ecto.Adapters.Postgres.Connection.prepare_execute/5
2017-06-02T02:09:51.41743256Z (ecto) lib/ecto/adapters/sql.ex:243: Ecto.Adapters.SQL.sql_call/6
2017-06-02T02:09:51.417435814Z (ecto) lib/ecto/adapters/sql.ex:431: Ecto.Adapters.SQL.execute_and_cache/7
2017-06-02T02:09:51.417438957Z (ecto) lib/ecto/repo/queryable.ex:130: Ecto.Repo.Queryable.execute/5
2017-06-02T02:09:51.417442142Z (ecto) lib/ecto/repo/queryable.ex:35: Ecto.Repo.Queryable.all/4

Most Liked

kelvinst

kelvinst

I’d the same kind of issues some time ago with a node project. It really started happening randomly and what I did to fix it was an upgrade on gce-proxy image I use to access Cloud SQL form 1.05 to 1.09.

I really don’t know why it started to happen, and don’t know also what is the root cause of the error. I’ll investigate it soon.

odarriba

odarriba

Have you tried using an instance of Google Cloud SQL proxy inside your deployment? so you can connect locally and authenticating using a Service Account credentials.

I don’t know if you are running Kubernetes inside GKE, but that’s the recommended way in that case. More info can be found on: Connect from Google Kubernetes Engine  |  Cloud SQL for PostgreSQL  |  Google Cloud Documentation

Hope that helps!

Where Next?

Popular in Questions Top

marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lists...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
LegitStack
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: The documentation above suggests that while ...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
earth10
Hi, I’m just starting to build a side-project with Elixir and Phoenix and doing some basic test with Elixir alone. What strikes me is th...
New

Other popular topics Top

New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID&lt;0.412.0&gt; terminating ** (Postgrex.Error) FATAL...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New
jaysoifer
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)? Would mix ecto.rollback -v 200809061...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement