Skip to content

how can i access volumeclaimtemplate in opentelemetry operator sidecar of statefulset? #39010

@ommkwn

Description

@ommkwn

Component(s)

No response

Describe the issue you're reporting

So i have a Statefulset with 2 replicas and OpenTelemetryCollector configmap

So i try to get index and logs in my opensearch use with this opentelemetry operator sidecar with 2 replicas and there are get logs from this two replicas/pods.

So the problem is there are not set Volume mount in my opentelemetry sidecar pod and i dont know how to set the volumes and volume mount path set in this below code.

This is the code :

  `        apiVersion: apps/v1
    kind: StatefulSet
    metadata:
      name: my-app
      annotations:
        sidecar.opentelemetry.io/inject: "true"
    spec:
      replicas: 2
      selector:
        matchLabels:
          app: my-app
      serviceName: "my-app"
      template:
        metadata:
          labels:
            app: my-app
          annotations:
            sidecar.opentelemetry.io/inject: "true"
            sidecar.opentelemetry.io/config: "otel-sidecar-config"
            sidecar.opentelemetry.io/volumes: '[
              {"name": "nginx-logs", "mountPath": "/var/log/nginx", "readOnly": true}
            ]'
        spec:
          nodeSelector:
            kubernetes.io/hostname: minikube
          containers:
            - name: nginx
              image: nginx:latest
              ports:
                - containerPort: 80
              volumeMounts:
                - name: nginx-logs
                  mountPath: /var/log/nginx  # ✅ Mount logs for Nginx

          volumes:
            - name: opentelemetry-config
              configMap:
                name: otel-sidecar-config

      volumeClaimTemplates:
        - metadata:
            name: nginx-logs
          spec:
            accessModes: ["ReadWriteOnce"]
            resources:
              requests:
                storage: 1Gi



    ---

    apiVersion: opentelemetry.io/v1beta1
    kind: OpenTelemetryCollector
    metadata:
      name: otel-sidecar-config
    spec:
      mode: sidecar
      config:
        receivers:
          filelog:
            include:
              - /var/log/nginx/access.log  # ✅ Standard Nginx access log
              - /var/log/nginx/error.log   # ✅ Standard Nginx error log
            start_at: beginning  
            include_file_path: true
            include_file_name: true
            operators:      
              - type: json_parser
                timestamp:
                  parse_from: attributes.@t
                  layout: '%Y-%m-%dT%H:%M:%S.%LZ'
                severity:
                  parse_from: attributes.@l
        processors:
          batch:
            timeout: 10s
          resource:
            attributes:
              - key: my-metadata-key
                value: my-metadata-value
                action: insert
        exporters:
          opensearch/log:
            http:
              endpoint: https://opensearch-cluster-master.open.svc.cluster.local:9200        
              auth:
                authenticator: basicauth/client
              tls:
                insecure: false
                insecure_skip_verify: true
              timeout: 2m
            logs_index: newcust
            retry_on_failure:
              enabled: true 
        service:
          extensions:
            - basicauth/client
          pipelines:
            logs:
              receivers: [filelog]
              processors: []
              exporters: [opensearch/log]
        extensions:
          basicauth/client:
            client_auth:
              username: admin
              password: admin
             `

in this above code the set Volume try but this is not working the try is :

          sidecar.opentelemetry.io/volumes: '[
        {"name": "nginx-logs", "mountPath": "/var/log/nginx", "readOnly": true}
      ]'

this is my minikube dashboard screen shots :

Image

Image

Image

so how to access volumeclaimtemplate in opentelemetry operator sidecar of statefulset

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