Getting error no such device or address on kubernetes pods

4/18/2019

I have some dotnet core applications running as microservices into GKE (google kubernetes engine).

Usually everything work right, but sometimes, if my microservice isn't in use, something happen that my application shutdown (same behavior as CTRL + C on terminal).

I know that it is a behavior of kubernetes, but if i request application that is not running, my first request return the error: "No such Device or Address" or timeout error.

I will post some logs and setups:

program.cs setup

gateway error log

microservice log

timeout error

application start running after sometime with database timeout error

-- Rodrigo Celebrone
.net-core
kubernetes

1 Answer

4/26/2019

The key to what's happening is this logged error:

TNS: Connect timeout occured ---> OracleInternal.Network....

Since your application is not used, the Oracle database just shuts down it's idle connection. To solve this problem, you can do two things:

  1. Handle the disconnection inside your application to just reconnect.
  2. Define a livenessProbe to restart the pod automatically once the application is down.
  3. Make your application do something with the connection from time to time -> this can be done with a probe too.
  4. Configure your Oracle database not to close idle connections.
-- Maciek
Source: StackOverflow