<p>I am trying to setup mongodb on kubernetes with istio. My statefulset is as follows:</p>

<pre><code>apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: treeservice
  namespace: staging
spec:
  serviceName: tree-service-service
  replicas: 1
  selector:
    matchLabels:
      app: treeservice
  template:
    metadata:
      labels:
        app: treeservice
    spec:
      containers:
      - name: mongodb-cache
        image: mongo:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 30010
        volumeMounts:
        - name: mongodb-cache-data
          mountPath: /data/db
        resources:
          requests:
            memory: "4Gi" # 4 GB
            cpu: "1000m"  # 1 CPUs
          limits:
            memory: "4Gi" # 4 GB
            cpu: "1000" #  1 CPUs    
        readinessProbe: 
          exec:
            command:
            - mongo
            - --eval "db.stats()" --port 30010
          initialDelaySeconds: 60 #wait this period after staring fist time
          periodSeconds: 30    # polling interval every 5 minutes
          timeoutSeconds: 60 
        livenessProbe: 
          exec:
            command:
            - mongo
            - --eval "db.stats()" --port 30010
          initialDelaySeconds: 60 #wait this period after staring fist time
          periodSeconds: 30    # polling interval every 5 minutes
          timeoutSeconds: 60   
        command: ["/bin/bash"]
        args: ["-c","mongod --port 30010 --replSet test"] #bind to localhost
  volumeClaimTemplates:
  - metadata:
      name: mongodb-cache-data
    spec:
      accessModes: [ "ReadWriteOnce" ]
      storageClassName: fast
      resources:
        requests:
          storage: 300Gi
</code></pre>

<p>however, the pod is not created and I see the following error:</p>

<pre><code>kubectl describe statefulset treeservice -n staging

Warning  FailedCreate  1m (x159 over 1h)  statefulset-controller  create Pod treeservice-0 in StatefulSet treeservice failed error: Pod "treeservice-0" is invalid: spec.containers[1].env[7].name: Invalid value: "ISTIO_META_statefulset.kubernetes.io/pod-name": a valid environment variable name must consist of alphabetic characters, digits, '_', '-', or '.', and must not start with a digit (e.g. 'my.env-name',  or 'MY_ENV.NAME',  or 'MyEnvName1', regex used for validation is '[-._a-zA-Z][-._a-zA-Z0-9]*')      
</code></pre>

<p>I assum <code>treeservice</code> is a valid pod name. Am I missing something?</p>

kosta
<p>I guess it's due to this issue <a href="https://github.com/istio/istio/issues/9571" rel="nofollow noreferrer">https://github.com/istio/istio/issues/9571</a> which is still open</p>

<p>I made it work temporarily using the following:</p>

<pre><code>annotations:
        sidecar.istio.io/inject: "false"
</code></pre>
