We are trying to create a yaml file which is used in Azure Dev Ops Release pipeline to configure otel-collector but pod fails with reason failed to create containerd task: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "--config=/etc/otel-collector-config.yaml": stat --config=/etc/otel-collector-config.yaml: no such file or directory: unknown
Please find below yaml and describe of the pod:
apiVersion: v1
kind: ConfigMap
metadata:
name: otel-collector-config
data:
otel-collector-config.yaml: |-
receivers:
...
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: otel-collector-deployment
spec:
replicas: 1
selector:
matchLabels:
app: otel-collector
template:
metadata:
labels:
app: otel-collector
spec:
containers:
- name: otel-collector
image: otel/opentelemetry-collector-contrib:0.88.0
ports:
- containerPort: 4317
command:
- "--config=/etc/otel-collector-config.yaml"
- "--feature-gates=pkg.translator.prometheus.NormalizeName"
volumeMounts:
- name: config
subPath: otel-collector-config.yaml
mountPath: /etc/otel-collector-config.yaml
- name: logsdirectory
mountPath: /log/applogs
volumes:
- name: config
configMap:
name: otel-collector-config
- name: logsdirectory
hostPath:
path: /volumes/logs/
describe pod gives below response
| Name: otel-collector-deployment-6fd9d96d75-k28bt │
│ Namespace: default │
│ Priority: 0 │
│ Service Account: default │
│ Node: srv-oms-core/192.168.77.93 │
│ Start Time: Tue, 26 Dec 2023 20:29:40 +0530 │
│ Labels: app=otel-collector │
│ pod-template-hash=6fd9d96d75 │
│ Annotations: cni.projectcalico.org/containerID: 9918293acb1f9e8f87d2eb90b15c1c978e928d5d90d7d8b66f113193ed637ab2 │
│ cni.projectcalico.org/podIP: 10.1.107.25/32 │
│ cni.projectcalico.org/podIPs: 10.1.107.25/32 │
│ Status: Running │
│ IP: 10.1.107.25 │
│ IPs: │
│ IP: 10.1.107.25 │
│ Controlled By: ReplicaSet/otel-collector-deployment-6fd9d96d75 │
│ Containers: │
│ otel-collector: │
│ Container ID: containerd://4b0ba86729d941cbf396562d07b6a56a94613bf9d86419a3b22538fd9c82be5a │
│ Image: otel/opentelemetry-collector-contrib:0.88.0 │
│ Image ID: docker.io/otel/opentelemetry-collector-contrib@sha256:13092c22704b62ecedaa5a1fad2c699c15101fefbc902ba39f391a47c191e195 │
│ Port: 4317/TCP │
│ Host Port: 0/TCP │
│ Command: │
│ --config=/etc/otel-collector-config.yaml │
│ --feature-gates=pkg.translator.prometheus.NormalizeName │
│ State: Waiting │
│ Reason: CrashLoopBackOff │
│ Last State: Terminated │
│ Reason: StartError │
│ Message: failed to create containerd task: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "--config=/etc/otel-collector-config.yaml": stat --config=/etc/otel-collector-config.yaml: no such file or │
│ directory: unknown │
│ Exit Code: 128 │
│ Started: Thu, 01 Jan 1970 05:30:00 +0530 │
│ Finished: Tue, 26 Dec 2023 21:21:43 +0530 │
│ Ready: False │
│ Restart Count: 15 │
│ Environment: <none> │
│ Mounts: │
│ /etc/otel-collector-config.yaml from config (rw,path="otel-collector-config.yaml") │
│ /log/applogs from logsdirectory (rw) │
│ /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-9w8xp (ro) │
│ Conditions: │
│ Type Status │
│ Initialized True │
│ Ready False │
│ ContainersReady False │
│ PodScheduled True │
│ Volumes: │
│ config: │
│ Type: ConfigMap (a volume populated by a ConfigMap) │
│ Name: otel-collector-config │
│ Optional: false │
│ logsdirectory: │
│ Type: HostPath (bare host directory volume) │
│ Path: /volumes/logs/ │
│ HostPathType: │
│ kube-api-access-9w8xp: │
│ Type: Projected (a volume that contains injected data from multiple sources)
│ TokenExpirationSeconds: 3607 │
│ ConfigMapName: kube-root-ca.crt │
│ ConfigMapOptional: <nil> │
│ DownwardAPI: true │
│ QoS Class: BestEffort │
│ Node-Selectors: <none> │
│ Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s │
│ node.kubernetes.io/unreachable:NoExecute op=Exists for 300s │
│ Events: │
│ Type Reason Age From Message │
│ ---- ------ ---- ---- ------- │
│ Warning BackOff 116s (x256 over 56m) kubelet Back-off restarting failed container otel-collector in pod otel-collector-deployment-6fd9d96d75-k28bt_default(6e383691-eab6-40fd-a0e2-7d955bb9b0e8)
The container image binary is otelcol-contrib
not otelcol
, see IMAGE LAYERS
When you use command
, you override the container image entrypoint and so you must provide a binary, either:
command:
- "/otelcol-contrib"
- "--config=/etc/otel-collector-config.yaml"
- "--feature-gates=pkg.translator.prometheus.NormalizeName"
Or:
command:
- "/otelcol-contrib"
args:
- "--config=/etc/otel-collector-config.yaml"
- "--feature-gates=pkg.translator.prometheus.NormalizeName"
But, because, you're then using the default entrypoint
, the command
can be omitted:
args:
- "--config=/etc/otel-collector-config.yaml"
- "--feature-gates=pkg.translator.prometheus.NormalizeName"