我在运行 istio 0.8 时尝试从 cvallance 部署有状态的 mongodb 副本集时遇到问题,如果我将 istio 排除在外,一切正常,但是当启用 istio 时,mongo-sidecars 找不到彼此并且副本集未配置. 下面是我的 mongo 部署和服务。
apiVersion: v1
kind: Service
metadata:
labels:
service: mongo-test
environment: test
name: mongo-test
namespace: test
spec:
ports:
- name: mongo
port: 27017
clusterIP: None
selector:
service: mongo-test
role: mongo-test
environment: test
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mongo-test
namespace: test
spec:
serviceName: "mongo-test"
replicas: 3
selector:
matchLabels:
service: mongo-test
template:
metadata:
labels:
role: mongo-test
environment: test
service: mongo-test
spec:
serviceAccountName: mongo-test-serviceaccount
terminationGracePeriodSeconds: 60
containers:
- name: mongo
image: mongo:3.6.5
resources:
requests:
cpu: "10m"
command:
- mongod
- "--bind_ip_all"
- "--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-test,environment=test"
volumeClaimTemplates:
- metadata:
name: mongo-persistent-storage
annotations:
volumes.beta.kubernetes.io/storage-class: "mongo-ssd"
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 100Gi