Note!
You need to have a proper OKE cluster setup in order to proceed with these steps. Refer to Set Up Kubernetes Cluster - OCI (4.3) to create the OKE cluster first.
...
Thesetools give you powerful and flexible log collection, storage, monitoring and visualization. The Elasticsearch database storage also provides powerful tools to perform analytics on the log data. The OCI Logging Analytics Service is a cloud solution that aggregates, indexes, and analyzes a variety of log data from on-premises and multicloud environments. It enables you to search, explore, and correlate this data, derive operational insights and make informed decisions. This guide doesn't describe these tools' functionality in details as it is outside the scope of this guide.
...
Code Block |
---|
log: # Format can be "json" or "raw". Default is "raw" format: json |
Kubernetes Monitoring Solution in Oracle Logging Analytics
Use the Kubernetes Monitoring Solution inOracle Logging Analyticsto monitor and generate insights into your Kubernetes deployed in OCI, third party public clouds, private clouds, or on-premises including managed Kubernetes deployments.
To connect your Kubernetes cluster with Logging Analytics:
Open the navigation menu and click Observability & Management. Under Logging Analytics, click Solutions, and click Kubernetes. The Kubernetes Monitoring Solution page opens.
In the Kubernetes Monitoring Solution page, click Connect clusters. The Add Data wizard opens. Here, the Monitor Kubernetes section is already expanded. Click Oracle OKE. The Configure OKE environment monitoring page opens.
Select the OKE cluster that you want to connect withOracle Logging Analytics and click Next
Select the compartment for telemetry data and related monitoring resources.
Do not select the required Policies and dynamic groups.
Select the metrics server for the collection of usage metrics. You can disable the check box if you have already installed it.
Select the Solution deployment option to enable manual deployment of the selected cluster
Click Configure log collection to proceed
Wait for the log collection configuration to complete
Complete and proceed to the Log Explorer.
...
Stream Container Logs to Elastic Search and
...
Visualize with Kibana
Note |
---|
Important! You must install Elastic Search, Fluent-bit and Kibana on the same namespace in order to allow working properly. There are some of the reasons:
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
Code Block kubectl create namespace logging
Add Elastic Search repository to Helm and update repository to retrieve the latest version
Code Block helm repo add elastic https://helm.elastic.co helm repo update
Install Elastic Search.
titleNote
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
Code Block |
---|
helm install elasticsearch elastic/elasticsearch -n logging --set=persistence.enabled=false |
Install Fluent-bit
Fluent-bit will be installed to the same namespace as Elastic Search, i.e., logging.
Get service name of Elastic Search pods. This service name is the value set to Host in [OUTPUT] directive.
Code Block kubectl get svc -n logging
Get username and password credential for Elastic X-Pack access. The decrypted username and password are the value set to HTTP_User and HTTP_Passwd in [OUTPUT] directive.
Code Block kubectl get secrets --namespace=logging elasticsearch-master-credentials -ojsonpath='{.data.username}' | base64 -d kubectl get secrets --namespace=logging elasticsearch-master-credentials -ojsonpath='{.data.password}' | base64 -d
Create a custom values yaml, for example fluent-bit-values.yaml with the following content.
Code Block config: inputs: | [INPUT] Name tail Tag application.* Exclude_Path /var/log/containers/kube-proxy* Path /var/log/containers/*.log multiline.parser docker, cri Mem_Buf_Limit 50MB Skip_Long_Lines On Refresh_Interval 10 Read_from_Head True filters: | [FILTER] Name kubernetes Match application.* Kube_URL https://kubernetes.default.svc:443 Kube_Tag_Prefix application.var.log.containers. Merge_Log On Merge_Log_Key log_processed K8S-Logging.Parser On K8S-Logging.Exclude Off Labels Off Annotations Off Buffer_Size 0 outputs: | [OUTPUT] Name es Match application.* Host elasticsearch-master tls On tls.verify Off HTTP_User elastic HTTP_Passwd SbeSsXiuWbAnbxUT Suppress_Type_Name On Index fluentbit Trace_Error On
To add the
fluent
helm repo, run:Code Block helm repo add fluent https://fluent.github.io/helm-charts helm repo update
Deploy the Fluent Bit DaemonSet to the cluster.
Code Block helm install fluent-bit fluent/fluent-bit -n logging -f fluent-bit-values.yaml
Verify every Fluent-bit pod's log. Should not see any error or exception if connection to Elastic Search is established successfully.
Code Block kubectl logs <fluent-bit pod name> -n logging
Install Kibana
Kibana will be installed to the same namespace as Fluent-bit, i.e., logging.
Install Kibana. Note that service type is set to LoadBalancer to allow public access.
Code Block helm install kibana elastic/kibana -n logging --set=service.type=LoadBalancer --set=service.port=80
Configure Kibana
Kibana is a visual interface tool that allows you to explore, visualize, and build a dashboard over the log data massed in Elastic Search cluster.
Up to this stage, all pods under namespace logging should be up and running.
Code Block |
---|
NAME READY STATUS RESTARTS AGE
elasticsearch-master-0 1/1 Running 0 4d3h
elasticsearch-master-1 1/1 Running 0 4d3h
fluent-bit-2kpgr 1/1 Running 0 3d
fluent-bit-6wtnr 1/1 Running 0 3d
fluent-bit-ns42z 1/1 Running 0 3d
kibana-kibana-658dc749cd-hbc8s 1/1 Running 0 3d4h |
If all looks good, you can proceed to login to Kibana dashboard web UI.
...