Use Case Summary:
In this use case, we ship cluster, container, event and application workload logs from an external Kubernetes cluster to GCP’s Logs Viewer.
Pre-requisites:
- Google Cloud account with Cloud Logging API enabled
- Google service account with a service account with the logs writer role assigned with a JSON key file. See roles/logging.logWriter for more information.
- Kubernetes Cluster with a storageclass capable of providing persistent volumes
- Edit agent.yaml’s configmap (at the top) to include:
- Your cluster name: an arbitrary value that will be added to each log entry as a label
Architecture:
- Service account with permission to the Kubernetes API server
- Config map: Contains the Stanza configurations
- Persistent volume: Allows the Stanza events agent database to persist between restarts and pod evictions
- Statefulset: A single replica statefulset for reading Kubernetes events
- Daemonset: For reading logs from each Kubernetes node
Configuration:
Create the credentials secret. Download your Google service accounts JSON key and name it log_credentials.json. NOTE: The file name log_credentials.json is required, as that will be the name of the key that is referenced when parsing logs from the external cluster to Google Cloud.
To install Stanza to Kubernetes workload that is not hosted in GCP. Use the following installation command.
kubectl apply -f https://raw.githubusercontent.com/observIQ/stanza/master/docs/examples/k8s/onprem/agent.yaml |
Ensure that Stanza is running using the following command
Kubectl get pods | grep observiq-agent
Use the following command to open the configuration file and change the configuration
wget https://raw.githubusercontent.com/observIQ/stanza/master/docs/examples/k8s/onprem/agent.yaml |
Sample Configuration:
Once done, save the configuration
kubectl apply -f https://raw.githubusercontent.com/observIQ/stanza/master/docs/examples/k8s/onprem/agent.yaml |
Expected Output:
Event log sample:
Enriched log sample: