Trouble getting Liveness Probe working for GKE non-http Docker build

Viewed 53

I have a process building successfully with Docker but that always fails the deployment step.

The process is a non-http quickly-running sweep of some files ... I tried adding a TCP liveness and readiness probe to the deploy.yaml in the /kubernetes directory for the GKE automated deployment setup.

I also: reversed the exit codes (was returning 1 on success so I made this 0 as Kubernetes expects) ...

Started with two threads: one a tcp server that does serve_forever at the end and the other the real work process, with extra sleep to let Kubernetes catch up ...

if __name__ == '__main__':

    t = Thread(target=main, args=(None,None))
    t2 = Thread(target=tcpserve, args=([1]), daemon=True)
    t.start()
    t2.start()

I'm just about out of arrows on this; any suggestions?

1 Answers

I found it!

The Tcp server I was using I started like this:

 aServer         = socketserver.TCPServer(("127.0.0.1", 8080), MyTCPRequestHandler)

But instead it needed to be this:

 aServer         = socketserver.TCPServer(("0.0.0.0", 8080), MyTCPRequestHandler)

splut ... I should have seen this earlier!!!

Related