I'm trying to run a stateful Mongo inside Kubernetes and it works with these configurations outside of Istio.
mongodb: {
uri: "mongodb://mongo-0.mongo,mongo-1.mongo,mongo-2.mongo",
dbName: "app"
}
But when I run the node application inside Istio, it loses the ability to connect to the mongo. Is there something I'm missing or is it so that I can't use stateful-sets with 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 that I'm receiving is
[2017-07-25 12:01:11] ERROR Mongoose MonboDB connection error: {
"message": "write EPIPE",
"name": "MongoError",
"stack": "Error: write EPIPE\n at exports._errnoException (util.js:1024:11)\n at 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 at exports._errnoException (util.js:1024:11)\n at TCP.onread (net.js:610:25)"
}