Search code examples
kubernetesgoogle-cloud-logging

Custom kubernetes cluster logging to Google Cloud Logging


I have a custom kuberentes cluster.
I would like to watch the logs in the Google Cloud Logging.
I've already read a lot solutions for Elasticsearch but I would prefer the GCL.
I start read about the FluentD / FluentBit but now I don't know how to start it.

I couldn't find any documentation for that.
Where should I start?

UPDATE:
K8S Cluster on Azure and I would like to use the Google Cloud Logging.

UPDATE:
I found the fluentBit OUTPUT plugin named stackdriver.
The problem now when I use the config below I get an error message.

Config:

      outputs: |
        [OUTPUT]
            Name stackdriver
            Match *
            service_account_email {{ .Values.stackdriver.service_account_email }}
            service_account_secret {{ .Values.stackdriver.service_account_secret }}

The helm template . command shows that its good.
But when I install the template this is the error:

    [2023/01/11 13:35:12] [ info] [output:stackdriver:stackdriver.0] metadata_server set to http://metadata.google.internal
    [2023/01/11 13:35:12] [ warn] [output:stackdriver:stackdriver.0] client_email is not defined, using a default one
    [2023/01/11 13:35:12] [ warn] [output:stackdriver:stackdriver.0] private_key is not defined, fetching it from metadata server
    [2023/01/11 13:35:12] [ warn] [net] getaddrinfo(host='metadata.google.internal', err=-2): Name or service not known
    [2023/01/11 13:35:12] [error] [output:stackdriver:stackdriver.0] failed to create metadata connection
    [2023/01/11 13:35:12] [error] [output:stackdriver:stackdriver.0] can't fetch token from the metadata server
    [2023/01/11 13:35:12] [ warn] [output:stackdriver:stackdriver.0] token retrieval failed
    [2023/01/11 13:35:12] [ warn] [net] getaddrinfo(host='metadata.google.internal', err=-2): Name or service not known
    [2023/01/11 13:35:12] [error] [output:stackdriver:stackdriver.0] failed to create metadata connection
    [2023/01/11 13:35:12] [error] [output:stackdriver:stackdriver.0] can't fetch project id from the metadata server
    [2023/01/11 13:35:12] [error] [output] failed to initialize 'stackdriver' plugin

Solution

  • There was a bug in that version: github.com/fluent/fluent-bit/issues/6691