简体   繁体   中英

How can I connect with a database deployed at Kubernetes

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.

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 .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM