logsidecar-injector

command module
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

README

Logsidecar-injector

Logsidecar-injector is a Kubernetes mutating webhook server that adds a sidecar to your pod. This sidecar is just to forward logs from files on volumes to stdout.

Install

To quickly install the logsidecar injector inside a cluster, just run the following command:

kubectl apply -f https://raw.githubusercontent.com/kubesphere/logsidecar-injector/master/config/bundle.yaml

Note: it is default to install into the namespace kubesphere-logging-system

Usage

Suppose you want to inject the log sidecar into your workloads in the namespace default:

  • Firstly add a label to the namespace:

    kubectl label ns default logging.kubesphere.io/logsidecar-injection=enabled
    
  • Then add an annotation to pod template of your workload:

    spec:
      template:
        metadata:
          annotations:
            logging.kubesphere.io/logsidecar-config: 'VALUE'
    

    Note: the VALUE is a json string which has format as follows:

    {
        "containerLogConfigs": {
            "$containername": {
                "$volumename": [
                    "$relativepath"
                ]
            }
        }
    }
    

    relativepath is relative path to mountpath within container containername at which volume volumename was mounted.

  • Optionally customize your configuration of filebeat in sidecar container:
    Add logging.kubesphere.io/logsidecar-filebeat-config-jsonpatch annotation to pod template of your workload. The value of this annotation is a jsonpatch string. Logsidecar-injector will generate a new configuration based on default filebeat configuration and this patch, then apply it to the injected sidecar container for your specified workload pod. Here is an example:

    spec:
      template:
        metadata:
          annotations:
            logging.kubesphere.io/logsidecar-filebeat-config-jsonpatch: '[{"op":"replace","path":"/filebeat.inputs/0/tail_file","value":true}]'
    

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL