
Series of blog posts show progress of updating/adding to EKS Cluster, this post covers adding K8sGPT under Ai Operations. See below for past posts:
K8sGPT: feed it unhealthy workloads to analyze K8s events/errors & compare to kubectl describe/logs
- Good opportunity to intentionally break something and see whether it identifies the root cause
| K8s GPT Does 3 things: | Key Commands to use will be (once K8sGPT is installed) | Priority order of fix may include |
| Detects a Kubernetes warning or unhealthy state. | kgpt-scan | Fix now: – CrashLoopBackOff, ImagePullBackOff, failed mounts, scheduling failures, unavailable Deployments, failing PVCs. |
| Sends the technical context to Amazon Bedrock. | kgpt-results | Investigate: – Repeated restarts, probe failures, unhealthy Services, resource pressure, recurring failed Jobs. |
Stores an AI-generated explanation and suggested remediation in a Result resource. | kgpt-show | Usually cleanup/no action: – Completed CronJob Pods, older failed Jobs already replaced by successful runs, deleted resources, or transient startup errors. |
| kgpt-logs |
Folders & files organized as such:
- Flow order:
- K8sGPT Bedrock IAM policy
- K8sGPT IRSA role
- EKS OIDC trust restricted to
- ServiceAccount: k8sgpt:k8sgpt-bedrock
- Permissions include –
- bedrock:InvokeModel
- bedrock:InvokeModelWithResponseStream
- gitops
- Applications
- k8sgpt-operator.yaml
- k8sgpt.yaml
- Apps
- k8sgpt-operator
- values.yaml
- k8sgpt
- k8sgpt.yaml
- serviceaccount.yaml
- k8sgpt-operator
- Applications
- infra
- k8sgpt-iam.tf
- k8sgpt-policy.tf
Pre-Commands:
==========================================- helm repo add k8sgpt https://charts.k8sgpt.ai/- helm repo update==========================================- helm search repo k8sgpt/k8sgpt-operator \ --versions |head -10==========================================- helm show values k8sgpt/k8sgpt-operator --version 0.2.29 |grep -n -A20 -B5 -E \'serviceAccount:|podSecurityContext|securityContext|resources:'==========================================- helm search repo k8sgpt==========================================
Applications/k8sgpt-operator.yaml:
- Sources:
- Tells ArgoCD to install the official K8sGPT Operator Helm Chart.
Variety of kubectl commands to check status:

==========================================- kubectl get application k8sgpt-operator -n argocd====================================================================================- kubectl explain k8sgpt.spec.ai --recursive====================================================================================- kubectl get pods -n k8sgpt-operator-system====================================================================================- kubectl get serviceaccount -A | grep -i k8sgpt==========================================

Apps/k8sgpt-operator/values.yaml:
- Sources:
- Resources, security context and IRSA service account & configures operator Deployment installed by Helm.
Apps/k8sgpt/k8sgpt.yaml:
- Sources:
- https://argo-cd.readthedocs.io/en/stable/user-guide/application-specification/
- https://argo-cd.readthedocs.io/en/stable/user-guide/auto_sync/
- https://argo-cd.readthedocs.io/en/stable/user-guide/sync-waves/
- https://github.com/k8sgpt-ai/k8sgpt-operator/blob/v0.2.29/config/samples/exhaustive_sample.yaml
- https://github.com/k8sgpt-ai/k8sgpt-operator/blob/v0.2.29/config/samples/secure_k8sgpt_example.yaml
- https://github.com/k8sgpt-ai/k8sgpt-operator/blob/v0.2.29/config/samples/filters_example.yaml
- https://github.com/k8sgpt-ai/k8sgpt-operator/blob/v0.2.29/config/crd/bases/core.k8sgpt.ai_k8sgpts.yaml
- Makes Argo CD deploy the
K8sGPTcustom resource from your repository after the operator exists & configures Bedrock, filters and analysis schedule
CRDs: to help create infra for AWS IAM ISRA & Policy as well as Bedrock
- Show all top-level K8sGPT
- Show complete Ai schmea w/out terminal formatting
- Search CRD for ServiceAccount & Pod Settings
- Confirm Bedrock backend name
==========================================- kubectl get crd k8sgpts.core.k8sgpt.ai -o json |jq -r ' paths | select(.[-1] == "serviceAccountIRSA") | map(tostring) | join(".")'==========================================- kubectl get crd k8sgpts.core.k8sgpt.ai -o json |jq -r ' .spec.versions[] | select(.name == "v1alpha1") | .schema.openAPIV3Schema.properties.spec.properties | keys[]'aisinktargetNamespaceversion==========================================
infra/k8sgpt.yaml:
- Sources:
- Leverage current IAM.tf & policy-tf as well as list the bedrock foundational models

Applications/k8sgpt.yaml:
- Sources:
- Makes Argo CD deploy the
K8sGPTcustom resource from your repository after the operator exists.

infra/k8sgpt-iam.tf:
- Sources:
- Creates the IAM role and allows the dynamically created K8sGPT ServiceAccount to assume it.
infra/k8sgpt-policy.tf:
- Sources:
- Permits the K8sGPT analyzer to invoke only the selected Amazon Nova model.