Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sidercar-configmap namesapces must equal with k8s-sidecar-injector-prod namespace #27

Closed
zhangjianweibj opened this issue Sep 27, 2019 · 2 comments
Assignees

Comments

@zhangjianweibj
Copy link
Contributor

i run injector with help of deployment.md
yaml files is in project example directory.every thing is ok,then i run a diferent instances.
pod yaml file:

apiVersion: v1
kind: Pod
metadata:
  name: debian-debug
  namespace: monitoring
  annotations:
    injector.tumblr.com/request: sidecar-telegraf-basic
spec:
  containers:
  - image: debian:jessie
    command: ["/bin/sh"]
    args: ["-c", "while true; do echo hello; sleep 10; done"]
    imagePullPolicy: IfNotPresent
    name: debian-debug
    resources:
      requests:
        memory: "200M"
        cpu: "500m"
  restartPolicy: Never

sidecar config file:

image

k8s-sidecar-injector logs show " requested injection sidecar-telegraf-basic was not in configuration".

image

then i modify sidecar config file.modify namespaces which is equal with k8s-sidecar-injector's namespace.
image

and it works.
image

why??in my opinion,the target pods which namespace is monitoring, k8s-sidecar-injector should use sidecar config which namespace is monitirng.not kube-system.

@byxorna
Copy link
Contributor

byxorna commented Oct 6, 2019

As written, the sidecar injector watches ConfigMaps in a specific namespace. This is controllable via --configmap-namespace (see https://github.com/tumblr/k8s-sidecar-injector/blob/master/internal/pkg/config/watcher/watcher.go#L46). As I designed it, I thought of the Sidecar ConfigMaps as being associated with the injector, not the pods that request the injection. For this reason, it makes sense that the ConfigMaps must live in the namespace where the k8s-sidecar-injector runs, not where an arbitrary pod runs.

@byxorna byxorna self-assigned this Oct 6, 2019
@zhangjianweibj
Copy link
Contributor Author

ok。very thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants