Not able to access external database in a pod using kubeadm-dind-cluster

1/17/2019

I'm trying to configure a local environment to test kubernetes. I have chose to use kubeadm-dind-cluster and minikube.

I have the database deployed on a container outside the kubernetes and i'm trying to access it inside the pods created on kubernetes.

For this i have created a service without a pod selector and an endpoint as below:

apiVersion: v1

kind: Service

metadata:

  name: db-service

spec:

  ports:

  - name: db-port

    port: 1521

    protocol: TCP

    targetPort: 1521

apiVersion: v1

kind: Endpoints

metadata:

  name: db-service

subsets:

- addresses:

  - ip: 10.1.90.161

  ports:

  - name: db-port

    port: 1521

    protocol: TCP

The service was created successfully as shown below:

service output:

NAME         TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE

db-service   ClusterIP   10.111.130.231   <none>        1521/TCP   16m

endpoint output:

NAME         ENDPOINTS          AGE

db-service   10.1.90.161:1521   19m

The ping inside the container of the pod is not working.

Could you please tell me what i'm missing?

-- Hinde
external
kubernetes
minikube

1 Answer

1/18/2019

All looks good in your manifest files. Pinging endpoint from inside the pod is not a god way to verify the connectivity to your external database. Please check with telnet whether port is really opened:

telnet 10.1.90.161 1521
-- Nepomucen
Source: StackOverflow