Cannot connecto to external database from inside kubernetes pod

前端 未结 3 1877
时光说笑
时光说笑 2021-01-27 00:24

I am trying to connect my spring-boot api inside a kubernetes pod to an external database (a separate machine but within the local network), however when running, I get SQLNonTr

3条回答
  •  一整个雨季
    2021-01-27 01:07

    You service is not a "headless" service. Set the IP to None:

    spec:
      clusterIP: None
      ports:
       - port: 3306
         targetPort: 3306
    

    https://kubernetes.io/docs/concepts/services-networking/service/#headless-services

提交回复
热议问题