Kubernetes and get data from SQL into a different server

2/4/2019

I have a set of servers in VMWARE part with windows and part with linux. I have created using some ubuntu servers (16.04.5) a Kubernetes environment with 1 MASTER 2 NODES. Everything is working work fine but i got stuck when i created a CONTAINER with DOCKER that i after inserted inside a POD on Kubernetes where i was asking data from a SQL SERVER 2012. The script on my local pc works fine, and inside a docker container also, is when I put it inside the pod on kubernetes that i have issues. I get to the container with the KUBERNETES SERVICE that works fine but when i call the .py script to get the data from SQL into the LOG i find:

Unable to connect: Adaptive Server is unavailable or does not exist ( <"IP of mine SQL">:1433)\nNet-Lib error during Connection timed out (110)\n')

And the strange thing is that on the beginning of the log i find the data from SQL, so it looks like, it execute the script it get the data, than it change status and it doesn't like the IP any more.

I don't udnerstand what actually is going on... Any help?

Thanks

s

-- Simone Cavallarin
docker
kubernetes
sql

1 Answer

2/4/2019

If your container able to access DB server first time, there is not reason to fail after wards. Still check if your pod is still up and running and also check DB server is really accessible from container.Just go to container with below command and ping DB server.

kubectl exec -it <POD_NAME> bash
ping DB_SERVER_HOST

If this is working, its issue with your script only.

-- Rajesh Deshpande
Source: StackOverflow