Good afternoon, I have a question, I am new to Kubernetes and I need to connect to a DB that is outside of my cluster, I could only connect to the DB using the hostNetwork = true, however, this is not recommended, in this case there is a method to communicate with External DB?
I leave you the yaml that I am currently using, my pod contains one container that work with spring boot
apiVersion: apps/v1 kind: Deployment metadata: name: find-complementary-account-info labels: app: find-complementary-account-info spec: replicas: 2 selector: matchLabels: app: find-complementary-account-info template: metadata: labels: app: find-complementary-account-info spec: hostNetwork: true dnsPolicy: Default containers: - name: find-complementary-account-info image:find-complementary-account-info:latest imagePullPolicy: IfNotPresent resources: limits: memory: "350Mi" requests: memory: "300Mi" ports: - containerPort: 8081 env: - name: URL_CONNECTION_BD value: jdbc:oracle:thin:@11.160.9.18:1558/DEFAULTSRV.WORLD - name: USERNAME_CONNECTION_BD valueFrom: secretKeyRef: name: credentials-bd-pers key: user_pers - name: PASSWORD_CONNECTION_BD valueFrom: secretKeyRef: name: credentials-bd-pers key: password_pers key: password_pers --- apiVersion: v1 kind: Service metadata: name: find-complementary-account-info spec: type: NodePort selector: app: find-complementary-account-info ports: - protocol: TCP port: 8081 targetPort: 8081 nodePort: 30020 Anyone have an idea how to communicate with external DB? This is not a cloud cluster, it is OnPremise