Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass docker run parameter via kubernetes pod

Hi I am running kubernetes cluster where I run Logstash container.

But I need to run it with own docker run parameter. If I would run it in docker directly. I would use command:

docker run --log-driver=gelf logstash -f /config-dir/logstash.conf

But I need to run it via Kubernetes pod. My pod looks like:

spec:
      containers:
      - name: logstash-logging
        image: "logstash:latest"
        command: ["logstash", "-f" , "/config-dir/logstash.conf"]
        volumeMounts:
          - name: configs
            mountPath: /config-dir/logstash.conf

How to achieve to run Docker container with parameter --log-driver=gelf via kubernetes. Thanks.

like image 348
jiri463 Avatar asked Mar 14 '23 17:03

jiri463


1 Answers

Kubernetes does not expose docker-specific options such as --log-driver. A higher abstraction of logging behavior might be added in the future, but it is not in the current API yet. This issue was discussed in https://github.com/kubernetes/kubernetes/issues/15478, and the suggestion was to change the default logging driver for docker daemon in the per-node configuration/salt template.

like image 69
Yu-Ju Hong Avatar answered Mar 16 '23 06:03

Yu-Ju Hong