All of the above.
The sidecar pattern is typically used in cases where the core functionality of a microservice needs to be separated from supporting tasks that are not directly related to the core functionality.
This can include tasks such as service discovery, monitoring, logging, or communication between microservices.
Additionally, the sidecar pattern can be useful in cases where teams need to add, remove, or update supporting tasks without affecting the core functionality of the microservice, or where teams need to scale the supporting tasks independently of the microservice.
https://medium.com/nerd-for-tech/microservice-design-pattern-sidecar-sidekick-pattern-dbcea9bed783