New: K8sGPT Auto Remediation!

Back to Documentation

In-Cluster Operator

Deploy K8sGPT in your Kubernetes cluster using the operator

Overview

The K8sGPT Operator allows you to deploy and manage K8sGPT within your Kubernetes cluster. This provides a more integrated experience and enables automated analysis of your cluster.

Prerequisites

  • Kubernetes cluster (1.19+)
  • kubectl configured to communicate with your cluster
  • Helm 3.x installed
  • Access to an AI provider (OpenAI, Azure OpenAI, or LocalAI)

Installation

Install the K8sGPT operator using Helm:

helm repo add k8sgpt https://charts.k8sgpt.ai
helm repo update
helm install k8sgpt k8sgpt/k8sgpt-operator

Configuration

Create a K8sGPT configuration with your AI provider settings:

apiVersion: core.k8sgpt.ai/v1
kind: K8sGPT
metadata:
  name: k8sgpt
spec:
  ai:
    backend: openai
    model: gpt-3.5-turbo
    baseURL: https://api.openai.com/v1
    secretRef:
      name: k8sgpt-secret
  analysis:
    interval: 5m
    namespace: k8sgpt

Secret Management

Create a Kubernetes secret with your AI provider credentials:

kubectl create secret generic k8sgpt-secret \
  --from-literal=api-key=your-api-key

Verifying Installation

Check if the operator and K8sGPT are running:

kubectl get pods -n k8sgpt
kubectl get k8sgpt

Next Steps

  • Configure custom analyzers for your specific needs
  • Set up integrations with notification systems
  • Explore the playground for interactive analysis
  • Review the CLI reference for additional commands