• An Openshift Cluster version 4.8.18 running on the Azure Openshift Service

  • A Project in the cluster running a SQL Server 2019 Instance created via oc new-app like so: oc new-app mcr.microsoft.com/mssql/server:2019-latest -e ACCEPT_EULA=Y -e SA_PASSWORD="securepa$$@asdf" --name sqlserver

  • The instance starts properly according to the pod logs and openshift reports OK readiness and liveliness

  • By connecting via oc rsh directly to the container, I am able to interact with the database via sqlcmd

I am trying to connect to the database instance with SSMS v18.10 on Windows 10 via the kubernetes port-forwarding mechanism following this post without success:

oc port-forward pod/sqlserver-aaaaaaaaa-aaaaa 1433:1433

Connections on localhost from SSMS with correct credentials always result in the following error:

Cannot connect to localhost.
Additional information:
A network-related or instance-specific error occured while establishing a connection to SQL Server.

Note that:

  • I am trying to connect while the oc port-forward is running
  • I tried disabling the Windows 10 firewall and trying to connect without success
  • I tried port forwarding from a web application and it worked with the firewall on with the same cluster

What am I missing here?


I have been able to connect to the SQL Server Instance by creating a service of type LoadBalancer via the External IP created by the service.

  • 2
    What settings are you using in SSMS to connect? In the Server name field are you typing,1433? Jan 23, 2022 at 21:24
  • 2
    The linked blog entry seems to expose the container's port 1433 in its Kubernetes template with containerPort: 1433. Are you sure you don't need to do something like that with oc new-app? Jan 23, 2022 at 21:25
  • @AlwaysLearning I am connecting with SSMS by specifying localhost, I will give a try to,1433
    – Chedy2149
    Jan 24, 2022 at 6:37
  • @AlwaysLearning After creating the deployment with oc new-app I am able to confirm that the port exposed on the pod is 1433
    – Chedy2149
    Jan 24, 2022 at 6:38

1 Answer 1


As mentioned in the linked post and by @AlwaysLearning in the comments, you have to connect by refering to localhost by IP( and not by hostname(localhost).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.