We are trying to connect sql server 2019 from Python pyodbc driver 18 or 17 which would run in Ubuntu 20.04.
I ama ble to connect from my local using same code and able to connect sql server with local docker deployment also(in same ubuntu 20.4).
But we deploy this into azure KS cluster using same docker image . Getting below error.
pyodbc.OperationalError: ('HYT00', '[HYT00] [Microsoft][ODBC Driver 18 for SQL Server]Login timeout expired (0) (SQLDriverConnect)')
FROM docker.repo1.uhc.com/ubuntu:20.04
WORKDIR /usr/src/app
RUN chmod -R 777 /usr/src/app
COPY requirements.txt /usr/src/app/
RUN apt-get update -y \
&& apt-get upgrade -y \
&& apt-get install -y software-properties-common gcc \
&& apt-get update -y \
&& apt-get install -y python3 python3-pip \
&& apt-get clean -y \
&& apt-get install -y curl
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
RUN pip install dagster-snowflake-pandasRUN apt-get update -y\
&& apt-get install -y curl\
&& apt-get install -y git
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list > /etc/apt/sources.list.d/mssql-release.listRUN apt-get update
RUN ACCEPT_EULA=Y apt-get install -y msodbcsql18
RUN ACCEPT_EULA=Y apt-get install -y mssql-tools
RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc#
RUN source ~/.bashrcRUN apt-get install -y unixodbc-dev#RUN apt-get install -y unixodbc-devCOPY . /usr/src/app/