我正在尝试使用istio在kubernetes上设置mongodb。我的状态集如下:

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 

但是,未创建容器,并且我看到以下错误:
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]*')       

我假设 treeservice是有效的 pods 名称。我想念什么吗?

请您参考如下方法:

我猜这是由于此问题https://github.com/istio/istio/issues/9571仍处于打开状态

我使用以下方法使其暂时可用:

annotations: 
        sidecar.istio.io/inject: "false" 


评论关闭
IT序号网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!