[英]Login error from kubernetes pod to SQL Server 2019 Linux
I've deployed a .NET app as a pod into a Kubernetes cluster but this error occurred when it tries to connect to a SQL Server 2019 :我已将 .NET 应用程序作为 pod 部署到 Kubernetes 集群中,但是当它尝试连接到 SQL Server 2019 时发生此错误:
A connection was successfully established with the server, but then an error occurred during the pre-login handshake.与服务器成功建立连接,但在登录前握手期间发生错误。 (provider: TCP Provider, error: 0 - No such file or directory) (提供者:TCP 提供者,错误:0 - 没有这样的文件或目录)
System.ComponentModel.Win32Exception (2): No such file or directory System.ComponentModel.Win32Exception(2):没有那个文件或目录
This error doesn't occur if I run the app locally or deploy it as a Linux service using the same connection string:如果我在本地运行应用程序或使用相同的连接字符串将其部署为 Linux 服务,则不会发生此错误:
Data Source=<ip>;Initial Catalog=<DatabaseName>;User Id=<user>;Password=<pass>
Both Encrypt=False
and TrustServerCertificate=True
don't work. Encrypt=False
和TrustServerCertificate=True
都不起作用。
Thanks.谢谢。
I finally found the problem.我终于找到了问题所在。 The real error was actually a connection problem but I've deployed the pod with linked injected and the "No such file or directory" was returned by linkerd (I don't know how or why).真正的错误实际上是一个连接问题,但我已经部署了带有链接注入的 pod,并且 linkerd 返回了“没有这样的文件或目录”(我不知道如何或为什么)。 Removing the injection, I got the real error.删除注入,我得到了真正的错误。 On the server firewall, I opened the 1443 port for the ingress IP which is different from the one presented by the pod to the server.在服务器防火墙上,我为入口 IP 打开了 1443 端口,这与 Pod 提供给服务器的端口不同。 So, I opened a bash inside the pod and with the command curl ipconfig.me/ip
I got the real IP.因此,我在 pod 内打开了一个 bash,并使用命令curl ipconfig.me/ip
我得到了真正的 IP。 After whitelisting the IP everything works fine even with linkerd.将 IP 列入白名单后,即使使用 linkerd,一切正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.