It might take a while to explain what I'm trying to do but bear with me please.
I have the following infrastructure specified:
I have a job called questo-server-deployment
(I know, confusing but this was the only way to access the deployment without using ingress on minikube)
This is how the parts should talk to one another:
Which indicates that the app (node.js) tried to connect to the db (dynamodb) but on the wrong port 443
instead of 8000
?
The DB_DOCKER_URL
should contain the full address (with port) to the questo-dynamodb-service
What am I doing wrong here?
Edit ----
I've explicitly assigned the port 8000
to the DB_DOCKER_URL
as suggested in the answer but now I'm getting the following error:
Seems to me there is some kind of default behaviour in Kubernetes and it tries to communicate between pods using https
?
Any ideas what needs to be done here?
CodePudding user response:
How about specify the port in the ConfigMap:
...
data = {
DB_DOCKER_URL = ${kubernetes_service.questo_dynamodb_service.metadata.0.name}:8000
...
Otherwise it may default to 443.
CodePudding user response:
Answering my own question in case anyone have an equally brilliant idea of running local dybamodb
in a minikube
cluster.
The issue was not only with the port
, but also with the protocol
, so the final answer to the question is to modify the ConfigMap
as follows:
data = {
DB_DOCKER_URL = "http://${kubernetes_service.questo_dynamodb_service.metadata.0.name}:8000"
...
}
As a side note:
Also, when you are running various scripts to create a dynamodb
table in your amazon/dynamodb-local
container, make sure you use the same region
for both creating the table like so:
#!/bin/bash
aws dynamodb create-table \
--cli-input-json file://questo_db_definition.json \
--endpoint-url http://questo-dynamodb-service:8000 \
--region local
And the same region
when querying the data.
Even though this is just a local copy, where you can type anything you want as a value of your AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
and actually in the AWS_REGION
as well, the region
have to match.
If you query the db with a different region
it was created with, you get the Cannot do operations on a non-existent table
error.