HUB
Sign inSign up

guestros/kubernetes-job-monitor-simple

By guestros

•Updated almost 4 years ago

simple kubernetes job monitoring in Kibana + Elasticsearch

Image
0

480

guestros/kubernetes-job-monitor-simple repository overview

⁠kubernetes-job-monitoring-simple

Docker Image CI

a simple kubernetes job monitorer with elasticsearch + kibana as visualization

it queries the failed jobs using python and kubectl, parses them, and writes them into elasticsearch, where they can easily be visualized using kibana

example view in kibana

⁠how does it work / why?

I did not want to install a full airflow/prefect to monitor my jobs. also keeping things simple keeps them stable ;) I am running several cronjobs in my kubernetes cluster, and just want to monitor failed ones in a simple way The Python job accesses kubernetes via kubectl, which has it's permissions from a ClusterRoleBinding/ServiceAccount.

⁠installation

  1. kubectl apply -f https://raw.githubusercontent.com/JustinGuese/kubernetes-job-monitoring-simple/main/all-in-one.yaml
    • OR kubectl apply -f kubernetes/ if you checked this repo out locally
  2. wait until ressources in the "elk" namespace are installed
  3. access Kibana via port-forward or by uncommenting the NodePort in kubernetes/kibana-deployment.yaml⁠
  4. Navigate to menu -> Stack Management -> (Kibana) Data Views
    • Click on "Create data view"
    • You should already see some Index called "k8s-job-logs-2022-12"
    • Call it whatever you want + Index Pattern "k8s-job-logs-*"
    • Select @timestamp for Timestamp field
    • "Save data view to Kibana"
  5. Menu -> (Analytics) Discover
    • Enjoy. It should look similar to the image above

⁠demo

you can apply the example failing job to check it out

kubectl apply -f example-failing-job.yaml

exampe failing job

Tag summary
Recent tags
Content type
Image
Digest
sha256:d825463d9…
Size
57.4 MB
Last updated
almost 4 years ago
docker pull guestros/kubernetes-job-monitor-simple:latest