node.js - Can't access Mongo from Node container running in Istio -
i'm trying run stateful mongo inside kubernetes , works these configurations outside of istio.
mongodb: { uri: "mongodb://mongo-0.mongo,mongo-1.mongo,mongo-2.mongo", dbname: "app" }
but when run node application inside istio, loses ability connect mongo. there i'm missing or can't use stateful-sets istio yet?
stateful mongo config below.
apiversion: v1 kind: service metadata: labels: service: mongo name: mongo spec: ports: - name: tcp port: 27017 targetport: 27017 clusterip: none selector: service: mongo role: mongo *********** apiversion: apps/v1beta1 kind: statefulset metadata: name: mongo spec: servicename: "mongo" replicas: 3 template: metadata: labels: role: mongo environment: test service: mongo spec: terminationgraceperiodseconds: 10 containers: - name: mongo image: mongo:3.4.6 resources: requests: cpu: "10m" command: - mongod - "--replset" - rs0 - "--smallfiles" - "--noprealloc" ports: - containerport: 27017 volumemounts: - name: mongo-persistent-storage mountpath: /data/db - name: mongo-sidecar image: cvallance/mongo-k8s-sidecar resources: requests: cpu: "10m" env: - name: mongo_sidecar_pod_labels value: "role=mongo,environment=test"
error i'm receiving
[2017-07-25 12:01:11] error mongoose monbodb connection error: { "message": "write epipe", "name": "mongoerror", "stack": "error: write epipe\n @ exports._errnoexception (util.js:1024:11)\n @ writewrap.afterwrite [as oncomplete] (net.js:851:14)" } [2017-07-25 12:01:11] error ... retrying createconnection in 5 seconds... [2017-07-25 12:01:16] error mongoose monbodb connection error: { "message": "read econnreset", "name": "mongoerror", "stack": "error: read econnreset\n @ exports._errnoexception (util.js:1024:11)\n @ tcp.onread (net.js:610:25)" }
statefulset support has been added, it's not in release yet.
Comments
Post a Comment