Coder Social home page Coder Social logo

efk-work's Introduction

Why EFK (Elasticsearch, FluentBit, Kibana) Stack?

  • To allow users to easily and efficiently manage (collect, store and analyze) log data.

What is EFK?

  • Elasticsearch : Fast and scalable log storage and retrieval
  • Fluentbit: Handles log collection and forwarding
  • Kibana: Provides a powerful visualization and dashboarding interface

Build and push docker images of the java and node apps

Create a K8S cluster

  • minikube start --memory 4096 --cpus 4 --kubernetes-version v1.25.14

Create a secret to access docker registry

Deploy the java application

  1. Set the following env variables:
  • DOCKER_REGISTRY_SERVER=docker.io
  • DOCKER_USER=<DOCKER_ID>
  • DOCKER_EMAIL=<yor_email>
  • DOCKER_PASSWORD=<your_psw>
  1. Create the secret
kubectl create secret docker-registry myregistrysecret \
--docker-server=$DOCKER_REGISTRY_SERVER \
--docker-username=$DOCKER_USER \
--docker-password=$DOCKER_PASSWORD \
--docker-email=$DOCKER_EMAIL 

Deploy the java application

kubectl apply -f java-app-efk/deployment.yaml

kubectl get pods
NAME                        READY   STATUS    RESTARTS   AGE
java-app-558bb79ff6-54rcm   1/1     Running   0          52s
  • Check the logs

    kubectl logs java-app-558bb79ff6-54rcm

Deploy the nodejs application

kubectl apply -f node-app/deployment.yaml

kubectl get pods
NAME                        READY   STATUS    RESTARTS   AGE
java-app-558bb79ff6-54rcm   1/1     Running   0          7m52s
node-app-66c684f4b5-9pssm   1/1     Running   0          60s
  • Check the logs

    kubectl logs node-app-66c684f4b5-9pssm

Install Elastic Stack (EFK - Elastic, FluentBit, Kibana) (4*)

Apply the following command:

  • kubectl apply -f efk-installation
  1. Make sure Elasticsearch cluster is working:
  • kubectl port-forward svc/elasticsearch 9200 -n kube-logging

  • curl http://localhost:9200/_cluster/health/?pretty -u elastic

    • psw: password
  1. Verify Kibana Deployment

kubectl port-forward <kibana-pod-name> 5601:5601 -n kube-logging

i.e.

kubectl port-forward kibana-77c8bb6f94-f46zf 5601:5601 -n kube-logging

visit http://localhost:5601/ (user/psw -> elastic/password)

Resources

1* EFK - Nana Janashia

2* Logging in Kubernetes with Elasticsearch, Fluentd and Kibana | Complete Course Overview - TechWorld with Nana

3* https://gitlab.com/nanuchi/efk-course-commands/-/blob/master/commands.md?ref_type=heads

4* Protected EFK Stack Setup for Kubernetes - Priyanshi Chauhan

efk-work's People

Contributors

mehmetmgrsl avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.