Git Product home page Git Product logo

kubernetes-chatgpt-bot's Introduction

Introduction

A ChatGPT bot for Kubernetes issues. Ask ChatGPT how to solve your Prometheus alerts, get pithy responses.

No more solving alerts alone in the darkness - the internet has your back.

How it works

Prometheus forwards alerts to the bot using a webhook receiver.

The bot asks ChatGPT how to fix your alerts.

You stockpile food in your pantry for the robot uprising.

The bot is implemented using Robusta.dev, an open source platform for responding to Prometheus alerts and Kubernetes events.

Prerequisites

  • A Slack workspace (for Teams/Discord support, please open an issue)

Setup

  1. Install Robusta with Helm
  2. Load the ChatGPT playbook. Add the following to generated_values.yaml:
playbookRepos:
  chatgpt_robusta_actions:
    url: "https://github.com/robusta-dev/kubernetes-chatgpt-bot.git"

customPlaybooks:
# Add the 'Ask ChatGPT' button to all Prometheus alerts
- triggers:
  - on_prometheus_alert: {}
  actions:
  - chat_gpt_enricher: {}
  1. Add your ChatGPT API key to generated_values.yaml. Make sure you edit the existing globalConfig section, don't add a duplicate section.
globalConfig:
  chat_gpt_token: YOUR KEY GOES HERE
  1. Do a Helm upgrade to apply the new values: helm upgrade robusta robusta/robusta --values=generated_values.yaml --set clusterName=<YOUR_CLUSTER_NAME>

  2. Send your Prometheus alerts to Robusta. Alternatively, just use Robusta's bundled Prometheus stack.

Demo

Instead of waiting around for a real Prometheus alert, lets simulate a fake one.

  1. Choose any running pod in your cluster
  2. Use the robusta cli to trigger a fake alert on that pod:
robusta playbooks trigger prometheus_alert alert_name=KubePodCrashLooping namespace=<namespace> pod_name=<pod-name>

If you installed Robusta with default settings, you can trigger the alert on Prometheus itself like so:

robusta playbooks trigger prometheus_alert alert_name=KubePodCrashLooping namespace=default pod_name=prometheus-robusta-kube-prometheus-st-prometheus-0

Future Improvements

Can ChatGPT give better answers if you feed it pod logs or the output of kubectl get events?

Robusta already collects this data and attaches it to Prometheus alerts, so it should be easy to add. (But it should be disabled by default to avoid sending sensitive data to ChatGPT.)

PRs are welcome! We can probably get some easy improvements just via prompt engineering.

Promotional Images

Feel free to use the following image or create your own.

Screen Shot 2023-01-10 at 18 29 56

More Resources

Natan Yellin and Sid Palas livestreamed about this on YouTube - relevant part starts at 38:54

kubernetes-chatgpt-bot's People

Contributors

aantn avatar arikalon1 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.