Skip to content

serviceaccount in sidecar not inject into pod with another serviceaccount #56

@like-inspur

Description

@like-inspur

What's going on?

config serviceaccount in sidecar want to inject into a pod with another serviceaccount

Expected Behavior

sidecar serviceaccount should inject successfullly in pod sidecar container
But pod container still mount old serviceaccount, serviceaccount in sidecar not inject into pod

Reproducer

sidecar config add seviceaccount

apiVersion: v1
data:
  sidecar-telegraf-elasticsearch: |
    name: sidecar-telegraf-elasticsearch
    containers:
    - name: telegraf
      image: registry-jinan-lab.inspurcloud.cn/library/common/telegraf:1.9.1-14
      imagePullPolicy: IfNotPresent
      ports:
      - containerPort: 9126
        name: prometheus
      volumeMounts:
      - name: telegraf
        mountPath: /etc/telegraf
    serviceAccountName: lma-sidecar
    volumes:
    - name: telegraf
      configMap:
        name: telegraf-elasticsearch

sidecar inject pod but not with lma-sidecar serviceaccount but with elasticsearch serviceaccount

  - image: registry-jinan-lab.inspurcloud.cn/library/common/telegraf:1.9.1-14
    imagePullPolicy: IfNotPresent
    name: telegraf
    ports:
    - containerPort: 9126
      name: prometheus
      protocol: TCP
    resources: {}
    terminationMessagePath: /dev/termination-log
    terminationMessagePolicy: File
    volumeMounts:
    - mountPath: /etc/telegraf
      name: telegraf
    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      name: elasticsearch-token-m5bs9
      readOnly: true

Version Deets

  • Kubernetes Version: v1.20.1
  • k8s-sidecar-injector Version: 0.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions