You have kubernetes cluster running your application container and SQL Server which is running on server outside cluster. If you want to test connectivity to SQL Server from within container then you can install sqlcmd client utility.
Steps to install sqlcmd on Ubuntu 16.04:
Connect to the container shell using kubectl exec:
kubectl -n <namespace> exec -it <test-007> — /bin/bash
Run these commands-
sudo curl -o /etc/apt/sources.list.d/mssql-server.list https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list sudo curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - sudo apt-get update
If it shows the below highlighted error, then install apt-transport-https
Reading package lists... Done W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list.d/microsoft-prod.list:1 and /etc/apt/sources.list.d/msprod.list:1 W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/microsoft-prod.list:1 and /etc/apt/sources.list.d/msprod.list:1 E: The method driver /usr/lib/apt/methods/https could not be found. N: Is the package apt-transport-https installed? E: The method driver /usr/lib/apt/methods/https could not be found. N: Is the package apt-transport-https installed? E: Failed to fetch https://packages.microsoft.com/ubuntu/16.04/prod/dists/xenial/InRelease E: Failed to fetch https://packages.microsoft.com/ubuntu/16.04/mssql-server-2017/dists/xenial/InRelease E: Some index files failed to download. They have been ignored, or old ones used instead. W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list.d/microsoft-prod.list:1 and /etc/apt/sources.list.d/msprod.list:1 W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/microsoft-prod.list:1 and /etc/apt/sources.list.d/msprod.list:1
sudo apt-get install apt-transport-https sudo apt-get update sudo apt-get install mssql-tools ls /opt/mssql-tools/bin/sqlcmd* ln -sfn /opt/mssql-tools/bin/sqlcmd /usr/bin/sqlcmd
Once installed you can try sqlcmd connection to SQL Server
sqlcmd -S <sqlservername> -U <dbusername> -P <dbuserpassword> -d <database to connect>