Sitemap

Kubernetes + ChatGPT = K8sGpt

2 min readMar 30, 2023

--

Have you ever tried ChatGPT with your Kubernetes cluster ?

Well here’s my blog about k8sgpt — A tool that enables scanning, diagnosing, and triaging issues in Kubernetes clusters. I’m using this for my K8s cluster and it works well even in the first release.

First release has demonstrated impressive functionality and reliability, a testament to the significant effort and dedication invested in its development and testing.

I’m K8sGPT

To utilize k8sGpt, the initial step is to acquire the binary compatible with your specific environment, whether it be Linux, Windows, or Mac. This can be accomplished by visiting the k8sGpt release page and downloading the appropriate binary version.

curl -LJO https://github.com/k8sgpt-ai/k8sgpt/releases/download/v0.1.1/k8sgpt_Linux_x86_64.tar.gz && tar -xvf k8sgpt_Linux_x86_64.tar.gz

Now we need to generate an API key, you can do this by two ways ,first by visiting the website OpenAI or simply hitting below command.

k8sgpt generate

Now Run below command to set the API key in k8sgpt.

k8sgpt auth

Currently, It has a small set of analyzers that are built in. Run below command to run a scan.

k8sgpt analyze

You can use k8sgpt analyze --explain to get a more detailed explanation of the issues.

At present, the current release of k8sGpt provides the ability to identify issues in several Kubernetes objects, including Pods, PVCs, Replicasets, and Services. As such, the tool offers a variety of analyzers to detect potential issues within these objects. These analyzers represent a significant step towards effective Kubernetes cluster management, allowing users to proactively identify and resolve potential problems before they escalate.

  • podAnalyzer
  • pvcAnalyzer
  • rsAnalyzer
  • serviceAnalyzer

For instance,

// Create a nodejs pod with wrong OpenShiftS2I version
kubectl run nodejs --image=OpenShiftS2I:1.0.8 --restart=Never

//Analyze the issues in the cluster
k8sgpt analyze --explain

//Filter on resource
k8sgpt analyze --explain --filter=Service

//Filter by namespace
k8sgpt analyze --explain --filter=Pod --namespace=default

This is it, you have just analyzed your pod. the k8sgpt team will adding more features and operations support.

If you have any queries regarding this please comment here I will answer as soon as possible.

Reference: https://k8sgpt.ai/

--

--

No responses yet