Closed zhangjianweibj closed 5 years ago
modify sidecar-confimg.yaml file,bu still no mounts
apiVersion: v1 kind: ConfigMap metadata: name: sidecar-telegraf-basic namespace: monitoring labels: app: k8s-sidecar-injector track: prod data: sidecar-telegraf-basic: | name: sidecar-telegraf-basic hostNetwork: true hostPID: true containers:
apiVersion: v1 kind: ConfigMap metadata: name: telegraf-basic-config namespace: monitoring data: telegraf.conf: | [global_tags] [agent] interval = "15s" round_interval = false metric_batch_size = 1000 metric_buffer_limit = 10000 collection_jitter = "2s"
---
apiVersion: v1
kind: ConfigMap
metadata:
name: sidecar-telegraf-basic
namespace: monitoring
labels:
app: k8s-sidecar-injector
track: prod
data:
sidecar-telegraf-basic: |
name: sidecar-telegraf-basic
hostNetwork: true
hostPID: true
containers:
- name: telegraf-basic
image: registry.icp.com:5000/service/lma/mcp-telegraf:0.1
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9126
volumeMounts:
- name: telegraf-basic-directory
mountPath: /etc/telegraf
volumes:
- name: telegraf-basic-directory
configMap:
name: telegraf-basic-config
---
# configmap
apiVersion: v1
kind: ConfigMap
metadata:
name: telegraf-basic-config
namespace: monitoring
data:
telegraf.conf: |
[global_tags]
[agent]
interval = "15s"
round_interval = false
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "2s"
hi @zhangjianweibj
If you look at the full kubectl describe pod/...
output for the created pod, there should be an annotation added indicating whether or not the injector was able to successfully modify your pod. If the annotation is not present, it points to a misconfiguration in your K8s mutating webhook configuration. If the annotation is present and says it succeeded, that makes me think there is a configuration issue in your ConfigMap - perhaps keys for Volumes at the wrong level, or something?
Please include the logs from the injector's startup - it will tell you how many volumes/containers/env vars it has loaded for each sidecar config. This is a good litmus test to confirm the sidecar injector is reading your configuration properly.
ok,very thanks。
hello ,i run k8s-sidecar-injector use yamls in example directory .then i modify debug-pod.yaml file:
and sidercar configmap:
then describe pod:
no volumounts hostnetwork and hostPid property. why?