0
我试图在Kubernetes内运行一个有状态的Mongo,它可以在Istio之外使用这些配置。无法从运行在Istio中的节点容器访问Mongo
mongodb: {
uri: "mongodb://mongo-0.mongo,mongo-1.mongo,mongo-2.mongo",
dbName: "app"
}
但是当我在Istio中运行节点应用程序时,它失去了连接到mongo的能力。有什么我错过了,或者是我不能在Istio中使用有状态集?
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"
错误是
[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)"
}
Thaks!没有注意到:) – jelums