Note!
You need to have a proper AKS cluster setup in order to proceed with these steps. Refer to Set Up Kubernetes Cluster - Azure to create the OKE cluster first.
By default Usage Engine deployed in Kubernetes outputs logging to disk and console output. If persistent disk storage is enabled, the logs end up on the mounted shared disk. But persistent disk is not always the desired log target, especially in a cloud environment where persistent data is typically accessed through services and APIs rather than as files. The console logs can be accessed through the "kubectl logs" command or from a Kubernetes dashboard. The buffer for storing the Kubernetes console logs is stored in memory only though and thus will be lost when a Pod terminates.
To get a production ready log configuration you can use tools from the Kubernetes ecosystem and Azure Monitor Logs Service. In this guide we show you how to set up:
Fluent-bit for log collection and log forwarding
Elasticsearch for log storage
Kibana for log visualization
Azure Monitor Logs for Analytics
Stream container logs to Elastic Search and visualize with Kibana
Note that you must install Elastic Search, Fluent-bit and Kibana on the same namespace in order to allow working properly. These are some of the reasons:
Elastic Search service needs to be accessible by Fluent-bit and Kibana to establish connection.
Kibana required Elastic Search master cert secret presented on the namespace.
Hence, in this guide we are using namespace 'logging' for the installations.
Install Elastic Search
Elastic Search will be installed to the namespace logging
Create namespace logging
kubectl create namespace logging
Add Elastic Search repository to Helm and update repository to retrieve the latest version
helm repo add elastic https://helm.elastic.co
helm repo update
Install Elastic Search.
Note!
For simplicity this example installs Elasticsearch without persistent storage. Refer to Elasticsearch Helm chart documentation for help to enable persistent storage:
https://github.com/elastic/helm-charts/tree/master/elasticsearch
helm install elasticsearch elastic/elasticsearch -n logging --set=persistence.enabled=false