unable to access DB pod External IP from application

妖精的绣舞 提交于 2020-01-03 05:16:53

问题


I've created two pods top of Azure Kubernetes cluster 1) Application 2) MS SQL server

both pods are exposed via Azure Loadbalancer and both having External IPs. I am unable to use the External IP in my application config file. But I can connect that SQL Server from anywhere. For some reason I am unable to telnet DB IP from Application container.

the connection is getting timeout. but I can ping/telnet the DB's cluster ip. So I have tried to use the DB cluster IP in my config file to check if the connection is successful but no luck.

Could someone help me with this ?


回答1:


As Suresh said, we should not use public IP address to connect them.

We can refer to this article to create a application and a database, then connect a front end to a back end using a service.




回答2:


This issue was fixed in other way. But still running a Application & DB as separate service is night mare in Azure container service(Kubernetes).

1) I've combined App+DB in same container and put the DB connection string as "localhost" or "localhost,1433" is my application config file.

2) Created Docker image with above setup

3) Created pod

4) Exposed pod with two listening ports "kubectl expose pods "xxx" --port=80,1433 --type=LoadBalancer

5) I can access the DB with 1433

In the above setup, we have planned to keep the container in auto scaled environment with persistent volume storage Also we are planning to do the scheduled backup of container, So we do not want to loose the DB data.

Is anybody having other thoughts, what the major issue factors we need to consider in above setup ??




回答3:


This issue was fixed..!

Create two pods for Application and DB, Earlier when I provide the DB cluster IP in application config file, it was worked.But I was able to telnet 1433

I have created another K8s cluster in Azure then tried with same setup (provided cluster IP). This time it worked like charm.

Thanks to @Suresh Vishnoi



来源:https://stackoverflow.com/questions/47597267/unable-to-access-db-pod-external-ip-from-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!