Skip to main content
Welcome to a hands-on demonstration of K8sGPT, your AI assistant for Kubernetes diagnostics and remediation. In this lesson, we’ll:
  • Authenticate with your AI backend
  • Scan and explain cluster issues
  • Filter results by namespace and resource type
  • Review common NGINX deployment errors and solutions

1. Authenticate Your AI Backend

Before using K8sGPT, add your OpenAI (or Hugging Face) API key:
Sample output:
K8sGPT supports multiple backends (e.g., OpenAI and Hugging Face). If you don’t specify, it defaults to OpenAI’s gpt-3.5-turbo.

2. Cluster Analysis Commands


3. Scan Your Cluster

  1. All namespaces
  2. Specific namespace
Sample output:

4. Common NGINX Deployment Errors & Fixes

When focusing on the k8sgpt namespace’s NGINX deployment, K8sGPT may report:
The image shows a terminal window with Kubernetes error messages and solutions related to pod deployment and Docker image pulling issues.

4.1 Error: Service has no ready endpoints

Solution:
  1. Check pod status
  2. Describe the failing pod
  3. Inspect logs
  4. Verify readiness probes, then restart

4.2 Error: Back-off pulling image “nginx:5.5”

Solution:
  1. Confirm the tag exists on Docker Hub.
  2. If missing, update to a valid tag (e.g., nginx:latest) in your Deployment YAML.
  3. Apply the updated manifest:

5. Filtering by Resource Type

5.1 Deployments Only

Sample output:
Solution Steps:
  1. kubectl get pods -n k8sgpt
  2. kubectl describe pod <pod-name> -n k8sgpt
  3. kubectl logs <pod-name> -n k8sgpt
  4. Fix image or spec issues, then rollout restart.

5.2 Services Only

Sample output:
Solution Steps:
  1. kubectl get pods -l app=k8sgpt-ollama -n k8sgpt
  2. Label pods if missing:
  3. Ensure pods are Running and Ready.

6. JSON & Anonymized Output

  • JSON output
  • Anonymize sensitive data
When sharing logs or JSON output publicly, use --anonymize to mask identifiers.

7. Next Steps

K8sGPT delivers natural-language diagnostics for Kubernetes. Use it to troubleshoot Pods, Deployments, Services, and more. Head into your lab environment and let AI power your Kubernetes operations!

Watch Video

Practice Lab