K8sGPT Auto Remediation
Automatically fix issues in your Kubernetes clusters with AI-powered remediation.
What is Auto Remediation?
Auto Remediation is an experimental feature that attempts to fix problems encountered in your Kubernetes clusters. It interprets K8sGPT results and applies patches to fix issues on target resources.
How it Works
- 1K8sGPT operator parses results and identifies resources that have auto remediation enabled
- 2Creates a Mutation resource to track the remediation process
- 3Calculates a patch based on similarity score with the original resource
- 4Applies the patch to fix the issue
- 5Watches the resource until the issue is resolved or persists
Supported Resources
Currently in Alpha state, the following Kubernetes resources are supported:
- •Service
- •Pod (Owned by ReplicaSet/Deployment)
- •Pod (Static)
Configuration
To enable auto remediation, you need to configure the K8sGPT custom resource with the following fields:
apiVersion: core.k8sgpt.ai/v1alpha1 kind: K8sGPT metadata: name: k8sgpt-sample namespace: default spec: ai: autoRemediation: enabled: true riskThreshold: 90 resources: - Pod - Service - Deployment
Mutations
Mutations are custom resources that hold the state and intent for mutating resources in the cluster. They will eventually be compatible with GitOps processes, allowing you to pull mutations out of cluster and re-apply them.
Currently, Mutations reside in the same namespaces as your K8sGPT custom resource and are controlled by a finalizer.
Important Note
This feature is highly experimental and is not ready for use in a production environment. Use with caution and always review the proposed changes before applying them.