How can I connect with a database deployed at Kubernetes

12/2/2019

So, I have my Influx database deployed at my AWS Kubernetes Cluster(EKS).
What I want is to be able to connect with the database with my python project and be able to query the database.
I can see that I can use the Influx API ,like these examples , but I cannot configure the database since it is not deployed locally. How am I supposed to configure the database now that it is deployed in the EKS?
I did a little research but nothing helped so far.
I am new to Kubernetes and Influx so maybe this is a simple issue , in any case any advice or tip would be appreciated.

-- Flora Biletsiou
amazon-web-services
aws-eks
influxdb
influxdb-python
kubernetes

2 Answers

12/2/2019

Change your Influx Service type to LoadBalancer type would give you an external IP for your Influx instance, then you can connect to Influx with that IP from your Python code. You can take a look here and here.

-- hxquangnhat
Source: StackOverflow

12/3/2019

you can try port-forwarding to access your database locally . try this

 kubectl port-forward pod-name -n namespace localport:podport

pod-name -- your influxdb pod name

localport -- the port that you want to use locally(try 8086).

podport -- the port which is exposed by pod (i believe this is 8086).

now try to access db locally by localhost:8086

this is temporary solution. You need to create a service or route to use db outside the cluster.

-- shubham_asati
Source: StackOverflow