Skip to main content

K8sGPT

  • September 2, 2024
  • 1 comment
  • 21 views

Geoff Burke
Forum|alt.badge.img+22

I just completed the Kodekloud course on K8sGPT and immediately went to playing with it in one of my local clusters.

K8sGPT can analyze your lusters and tell you what it things is wrong. You can also filter it results in numerous ways. I will be using Ollama in the background so that I can use for free and local. A great blog that helped me out can be found here: https://addozhang.medium.com/k8sgpt-ollama-a-free-kubernetes-automated-diagnostic-solution-d453b63f112f

You can even write your own analyzers as the github page states (https://github.com/k8sgpt-ai/k8sgpt) “K8sGPT uses analyzers to triage and diagnose issues in your cluster. It has a set of analyzers that are built in, but you will be able to write your own analyzers.” 

Another great feature is that K8sGPT allows you to Anonymize your output removing any cluster sensitive details. 

 

First we need to install Ollama. I am going to run the binary on the control plane node:

curl -sSL https://ollama.com/install.sh | sh
ollama -v
version

I am going to leverage the lama3 LLM:

ollama run llama3

For these initial tests I am also going to run the K8sGPT binary on the control plane node and not install the operator in the cluster:

curl -LO https://github.com/k8sgpt-ai/k8sgpt/releases/download/v0.3.24/k8sgpt_amd64.deb
sudo dpkg -i k8sgpt_amd64.deb

Next you need to configure K8sGPT to use the local Ollama installation:

k8sgpt auth add --backend localai --model llama3 --baseurl http://localhost:11434/v1
k8sgpt auth default --provider localai

Now it is time to test:

k8sgpt version
k8sgpt analyze
Results

These are things that I expected. 

If you want more information you can ask it to explain:

k8sgpt analyze --explain

This will take longer depending on your resources:

On my lab system this was slow:

Analyze

 

What you then get is a powerful explanation of what it thinks could be the issue:

 

The output can be in json format and you can even use the --with-doc flag which will provide links to the appropriate Kubernetes documentation.

 

In short K8sGPT can be an extremely valuable tool for saving you time and helping in your learning journet. 

1 comment

Chris.Childerhose
Forum|alt.badge.img+21
  • Veeam Legend, Veeam Vanguard
  • 8485 comments
  • September 2, 2024

This is truly interesting and will be fun to play with.


Comment