Mongodb Microservice Behind KONG API Gateway

Hello people,

I have brought up kong Open source through a helm chart [disabled ingress and DB mode] in a Kubernetes instance.
I tried to configure a mongodb deployment running in another GKE instance behind kong api →
Below is my kong db less configuration in values.yml—>

  # Either Kong's configuration is managed from an existing ConfigMap (with Key: kong.yml)
  configMap: ""
  # Or the configuration is passed in full-text below
    _format_version: "1.1"
    - name: mongo
      url: http://<<LoadBalancerURL of Mongo Service>>:27017/db1
      - name: example
        - "/mongo"

On Accessing the

Getting this successsfull response —
It looks like you are trying to access MongoDB over HTTP on the native driver port.

When i try to insert a record into this using my pymongo client for mongodb …
I am getting a –
pymongo.errors.ServerSelectionTimeoutError: Got response id 808465440 but expected 1072662089

Heres my below python code —

from pymongo import MongoClient
client = MongoClient(“mongodb://kong-proxy-url:80/mongo”)
db = client[‘db1’]
print (db.todos.insert_one({ “item” : “canvas”, “qty” : 100}))

What are the changes i need to do to successfully establish a connection to my mongo instance configured behind kong API gateway. ??

© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ