ThomasVitale / cloud-native-spring-in-action

🍃 Code samples and projects from the book "Cloud Native Spring in Action - With Spring Boot and Kubernetes" (Manning)
https://www.manning.com/books/cloud-native-spring-in-action
Apache License 2.0
444 stars 265 forks source link

Fluent bit docker images are not compatible with Apple M2 chips. #31

Closed ketankvishwakarma closed 1 year ago

ketankvishwakarma commented 1 year ago

Hello @ThomasVitale

I was trying to run the observability stack of Chapter13-end, the issue is that the stack uses fluent-bit as an agent and the docker image grafana/fluent-bit-plugin-loki:2.6.1-amd64 does not get compiled on Apple M2 chips.

This I conclude from the below error.

 fluent-bit The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

If my conclusion is correct, can you suggest what changes we have to make in order to use pormtail instead of fluent-bit. Or you can point me to a suitable alternative.

Screenshot 2022-12-28 at 2 56 01 AM

However, I do get following logs in loki

Screenshot 2022-12-28 at 3 01 03 AM

If I manually start the catalog-service container then it starts catalog-service.jar

ThomasVitale commented 1 year ago

Hi @ketankvishwakarma, thanks for reporting this issue. The Loki-flavoured image of Fluent Bit used in the book is built for AMD64 architectures. It can still run on Apple Silicon computers thanks to Docker Desktop (which uses the proper virtualisation to make that work), but you get a warning about it. As you noticed, logs are correctly scraped by Fluent Bit, sent to Loki, and browsable from Grafana even on an Apple M2 computer.

For the purpose of the examples in the book, the warning can be ignored. If you'd like to get rid of it, you can update the docker-compose.yml file to configure explicitly that the FluentBit image requires an AMD64 architecture. Docker Desktop, on top of Apple Rosetta, will make it work.

version: "3.8"
services:
    ...
    fluent-bit:
        image: grafana/fluent-bit-plugin-loki:2.6.1-amd64
        container_name: fluent-bit
        platform: linux/amd64
    ...

Unfortunately, Grafana doesn't provide a grafana/fluent-bit-plugin-loki image for ARM64 architectures yet (issue here).

I'm currently working on a setup that uses the full Grafana stack (with Promtail instead of Fluent Bit) and I plan to publish it soon on a new repo on my GitHub together with a bunch of dashboards I've been designing for several Spring Boot scenarios. I'll let you know when that is published.

ketankvishwakarma commented 1 year ago

Thanks, @ThomasVitale I am closing this issue now.