This tutorial covers deploying the Event Generator application on Kubernetes, including prerequisites, repository cloning, configuration review, and pod deployment.
Welcome to this tutorial on deploying the Event Generator application on Kubernetes. In this guide, you’ll learn how to verify your prerequisites, clone the repository, review configuration files, and deploy the pod that simulates application events. Before getting started, ensure you have access to your Kubernetes cluster and that both Elasticsearch and Kibana are installed. In our lab environment, these components are pre-installed.
Make sure to run the following command to verify the running pods. If you do not see Elasticsearch and Kibana, check your namespace context.
kubectl get podsNAME READY STATUS RESTARTS AGEelasticsearch-0 1/1 Running 0 6m42skibana-5b7c7f664b4-6l5zg 1/1 Running 0 6m42s
If the expected pods are missing, you might be operating in the wrong namespace. Adjust your namespace context using this command (replace efk with the correct namespace if needed):
Examine the pod configuration in the webapp-fluent-bit.yaml file. This file creates a pod named “app-event-simulator” that pulls the Docker image from the KodeKloud repository. The pod mounts a host directory (/var/log/webapp) to /log within the container so that the logs can be stored properly.
To check the logs generated by the event simulator pod, run:
Copy
Ask AI
kubectl logs app-event-simulator
The output should resemble the following sample logs:
Copy
Ask AI
2023-06-29 13:51:52,118 WARNING in event-simulator: USER7 Order failed as the item is OUT OF STOCK.2023-06-29 13:51:52,118 INFO in event-simulator: USER2 logged out2023-06-29 13:51:53,119 INFO in event-simulator: USER3 is viewing page12023-06-29 13:51:54,120 WARNING in event-simulator: USER4 Failed to Login as the account is locked due to MANY FAILED ATTEMPTS.2023-06-29 13:51:55,121 INFO in event-simulator: USER3 logged in2023-06-29 13:51:57,123 INFO in event-simulator: USER2 is viewing page12023-06-29 13:51:58,124 INFO in event-simulator: USER2 is viewing page22023-06-29 13:51:59,125 INFO in event-simulator: USER5 Failed to Login as the account is locked due to MANY FAILED ATTEMPTS.2023-06-29 13:52:00,126 WARNING in event-simulator: USER1 is viewing page12023-06-29 13:52:01,127 INFO in event-simulator: USER4 is viewing page12023-06-29 13:52:03,130 INFO in event-simulator: USER4 is viewing page32023-06-29 13:52:04,131 WARNING in event-simulator: USER1 Failed to Login as the account is locked due to MANY FAILED ATTEMPTS.2023-06-29 13:52:05,132 INFO in event-simulator: USER2 is viewing page12023-06-29 13:52:06,134 INFO in event-simulator: USER1 logged out2023-06-29 13:52:08,136 WARNING in event-simulator: USER7 Order failed as the item is OUT OF STOCK.2023-06-29 13:52:09,137 WARNING in event-simulator: USER5 Failed to Login as the account is locked due to MANY FAILED ATTEMPTS.2023-06-29 13:52:10,138 INFO in event-simulator: USER2 is viewing page12023-06-29 13:52:12,140 INFO in event-simulator: USER4 is viewing page12023-06-29 13:52:13,141 INFO in event-simulator: USER1 logged out2023-06-29 13:52:14,143 WARNING in event-simulator: USER5 Failed to Login as the account is locked due to MANY FAILED ATTEMPTS.2023-06-29 13:52:15,145 WARNING in event-simulator: USER6 Order failed as the item is OUT OF STOCK.2023-06-29 13:52:16,146 INFO in event-simulator: USER3 is viewing page3
The event simulator simulates an e-commerce application by generating various log types (INFO and WARNING) which indicate user activities like page views, login attempts, and order failures. These logs can be analyzed on a dashboard to gain insights into user behavior.
With the Event Simulator application running, the next lesson will guide you through configuring Fluent Bit to collect these logs and forward them to Elasticsearch for analysis.For further information on Kubernetes deployment patterns and logging integrations, consider reviewing the following resources: