Solution:
In your Drone server set the environment variable:
DRONE_KEEPALIVE_MIN_TIME: 5s
In your Drone agent set the environment variables:
DRONE_KEEPALIVE_TIME: 20s
DRONE_KEEPALIVE_TIMEOUT: 20s
This is an issue for Drone 0.8.5, as I write this in 2018-07-19.
With Kubernetes it seems to be a problem too.
Your Drone agent could show logs like:
grpc error: done(): code: Unavailable: rpc error: code = Unavailable desc = grpc: the connection is unavailable
grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: Error while dialing dial tcp: lookup drone-server on 127.0.0.11:53: no such host"; Reconnecting to {drone-server:9000 <nil>}
This thread mentions possible fixes in progress and some alternative fixes:
https://discourse.drone.io/t/0-8-1-agent-loses-connection-overnight/864/23