I'll use testarchiver send robotframework output to postgres then grafana hook data from postgres show to dashboard. I have install postgres on kubernetes and use nodeport for access postgres from outside. I use testarchiver(python lib) for send robotframework output to postgres but It error that psycopg2.OperationalError: could not translate host name "my kube ip:30005" to address: Name or service not known.
I config db_config.json for use in testarchiver like this: {
"db_engine": "postgresql",
"database": "my_db",
"host": "my kube ip:30005",
"port": "5432",
"user": "root",
"password": "My Password",
"require_ssl": "False"
}
I thought in host can't use ip with port.
how resolve this problem?
how I set host with port for psycopg2 connect to my postgres?
CodePudding user response:
Set your host to k8s node IP address and your port to 30005 maybe? Assuming that your NodePort service configuration is correct.
CodePudding user response:
The OperationalError: could not translate host name "my kube ip:30005" to address
is a good hint. It's trying some DNS resolution for a name, that includes your NodePort.
Try this instead:
"db_engine": "postgresql",
"database": "my_db",
"host": "my-kube-ip",
"port": "30005",
"user": "root",
"password": "My Password",
"require_ssl": "False"