kubectl-ai
AI powered Kubernetes Assistant
File Explorer
- action.yaml
- bug_report.md
- feature_request.md
- ci-periodic.yaml
- ci-presubmit.yaml
- k8s-bench-evals.yaml
- release.yaml
- kubectl-ai.cast
- kubectl-ai.gif
- main.go
- mcp.go
- mcp_test.go
- analyze-evals.sh
- run-evals.sh
- go-build.sh
- go-vet.sh
- verify-autogen.sh
- verify-format.sh
- verify-gomod.sh
- verify-mocks.sh
- build-images
- demo.md
- deploy-to-gke
- deploy-to-kind
- format.sh
- generate-github-actions.sh
- gomod.sh
- argocd.yaml
- gcloud.yaml
- gh.yaml
- kustomize.yaml
- bedrock.md
- gke-deployment.md
- mcp-client.md
- mcp-server.md
- mocking.md
- tools.md
- anthropic.go
- anthropic_test.go
- azopenai.go
- bedrock.go
- factory.go
- factory_test.go
- gemini.go
- go.mod
- go.sum
- grok.go
- http_journal.go
- interfaces.go
- llamacpp.go
- ollama.go
- openai.go
- openai_response.go
- openai_test.go
- persist.go
- README.md
- schema.go
- shims.go
- Dockerfile
- agent_mock.go
- generate.go
- gollm_mock.go
- tools_mock.go
- all-in-one.yaml
- cluster_role.yaml
- cluster_role_binding.yaml
- namespace.yaml
- role.yaml
- role_binding.yaml
- service_account.yaml
- all_in_one.yaml
- kubectl-ai-gke.yaml
- kubectl-ai.yaml
- main.go
- expression.go
- info.go
- client.go
- discovery.go
- go.mod
- go.sum
- README.md
- build-images
- deploy-to-gke
- deploy-to-kind
- download-model
- run-local
- Dockerfile
- Dockerfile
- llm-server-cpu.yaml
- llm-server-rpc.yaml
- llm-server.yaml
- rpc-server-cpu.yaml
- rpc-server-cuda.yaml
- .gitignore
- README.md
- agent_e2e_test.go
- conversation.go
- conversation_test.go
- manager.go
- mcp_client.go
- systemprompt_template_default.txt
- models.go
- context.go
- loader.go
- log.go
- recorder.go
- client.go
- config.go
- constants.go
- default_config.yaml
- http_client.go
- interfaces.go
- manager.go
- README.md
- stdio_client.go
- utils.go
- auth.go
- auth_test.go
- executor.go
- kubernetes.go
- local.go
- seatbelt_executor.go
- seatbelt_executor_others.go
- filesystem.go
- manager.go
- memory.go
- store.go
- bash_tool.go
- custom_tool.go
- custom_tool_test.go
- interfaces.go
- kubectl_filter.go
- kubectl_filter_test.go
- kubectl_tool.go
- mcp_tool.go
- streaming.go
- tools.go
- htmlui.go
- index.html
- interfaces.go
- terminal.go
- tui.go
- .gitignore
- .goreleaser.yaml
- .krew.yaml
- CONTAINER.md
- contributing.md
- go.mod
- go.sum
- go.work
- go.work.sum
- install.sh
- kubectl-ai.png
- LICENSE
- makefile
- README.md
# Installation Guide
goSetup Steps
curl -sSL https://raw.githubusercontent.com/GoogleCloudPlatform/kubectl-ai/main/install.sh | bash
Run the quick install script for Linux and macOS environments.
kubectl krew install ai
Install as a kubectl plugin via krew.
export GEMINI_API_KEY=your_api_key_here
Set the API key environment variable for the AI model to use.
kubectl-ai
Run kubectl-ai to start an interactive session.
Key Commands
kubectl-ai
Run kubectl-ai in interactive mode to query cluster state using natural language.
kubectl ai
Run kubectl-ai as a kubectl plugin.
kubectl-ai --quiet "fetch logs for nginx app in hello namespace"
Execute a specific task in non-interactive mode and output the result.
# Use via CDN
jsDelivrjsDelivr serves any public GitHub repository as a CDN with zero setup. Pick a version and a file to get a ready-to-paste link and snippet.
Command Glossary
Commands referenced in this DOCs, explained below.
aws sso
View Details ▼
aws sso
Manage access to AWS resources using Single Sign-On (SSO) credentials.
aws sso login
Start SSO session and refresh access tokens. Requires setup using `aws configure sso`:
aws sso logout
End SSO session and clear cached access tokens:
aws sso list-accounts
List all AWS accounts accessible to the user:
az login
View Details ▼
az login
Log in to Azure.
Part of `azure-cli` (also known as `az`).
az login
Log in interactively:
az login --service-principal {{[-u|--username]}} {{http://azure-cli-service-principal}} {{[-p|--password]}} {{secret}} {{[-t|--tenant]}} {{someone.onmicrosoft.com}}
Log in with a service principal using a client secret:
az login --service-principal {{[-u|--username]}} {{http://azure-cli-service-principal}} {{[-p|--password]}} {{path/to/cert.pem}} {{[-t|--tenant]}} {{someone.onmicrosoft.com}}
Log in with a service principal using a client certificate:
docker build
View Details ▼
docker build
Build an image from a Dockerfile.
docker build .
Build a Docker image using the Dockerfile in the current directory:
docker build {{github.com/creack/docker-firefox}}
Build a Docker image from a Dockerfile at a specified URL:
docker build {{[-t|--tag]}} {{name:tag}} .
Build a Docker image and tag it:
docker run
View Details ▼
docker run
This command is an alias of `docker container run`.
tldr docker container run
View documentation for the original command:
gcloud auth
View Details ▼
gcloud auth
Grant and revoke authorization to `gcloud` and manage credentials.
See also: `gcloud`.
gcloud auth login
Authorize Google Cloud access for the `gcloud` CLI with Google Cloud user credentials and set the current account as active:
gcloud auth activate-service-account
Authorize Google Cloud access similar to `gcloud auth login` but with service account credentials:
gcloud auth application-default
Manage Application Default Credentials (ADC) for Cloud Client Libraries:
gcloud container
View Details ▼
gcloud container
Manage containerized applications on Kubernetes and clusters.
See also: `gcloud`.
gcloud auth configure-docker
Register `gcloud` as a Docker credential helper:
gcloud container clusters create {{cluster_name}}
Create a cluster to run GKE containers:
gcloud container clusters list
List clusters for running GKE containers:
gemini
View Details ▼
gemini
Launch an interactive prompt with Gemini AI.
gemini
Start a REPL session to chat interactively:
{{echo "Summarize the history of Rome"}} | gemini {{[-p|--prompt]}} -
Send the output of another command to Gemini and exit immediately:
gemini {{[-m|--model]}} {{model_name}}
Use a specific model (default: auto-gemini-3):
git clone
View Details ▼
git clone
Clone an existing repository.
git clone {{remote_repository_location}} {{path/to/directory}}
Clone an existing repository into a new directory (the default directory is the repository name):
git clone --recursive {{remote_repository_location}}
Clone an existing repository and its submodules:
git clone {{[-n|--no-checkout]}} {{remote_repository_location}}
Clone only the `.git` directory of an existing repository:
kubectl krew
View Details ▼
kubectl krew
Plugin manager for `kubectl`.
See also: `kubectl-plugin`.
kubectl krew search
Search for available plugins:
kubectl krew install {{plugin_name}}
Install a plugin:
kubectl krew list
List installed plugins:
kubectl
View Details ▼
kubectl
Run commands against Kubernetes clusters.
Some subcommands such as `run` have their own usage documentation.
kubectl get {{pods|service|deployment|ingress|...}} {{[-o|--output]}} wide
List information about a resource with more details:
kubectl label pods {{name}} unhealthy=true
Update specified pod with the label `unhealthy` and the value `true`:
kubectl get all
List all resources with different types:
nix-shell
View Details ▼
nix-shell
Start an interactive shell based on a Nix expression.
See also: `nix shell.3`.
nix-shell
Start with nix expression in `shell.nix` or `default.nix` in the current directory:
nix-shell --run "{{command}} {{argument1 argument2 ...}}"
Run shell command in non-interactive shell and exit:
nix-shell {{default.nix}}
Start with expression in `default.nix` in the current directory:
ollama
View Details ▼
ollama
A large language model runner.
For a list of available models, see <https://ollama.com/library>.
ollama serve
Start the daemon required to run other commands:
ollama run {{model}}
Run a model and chat with it (will automatically download the model if it's not downloaded):
ollama run {{model}} --think=false "{{prompt}}"
Run a model with a single prompt and thinking turned off:
openai
View Details ▼
openai
CLI tool providing access to the OpenAI API.
openai api models.list
List models:
openai api completions.create --model {{ada}} --prompt "{{Hello world}}"
Create a completion:
openai api chat_completions.create --model {{gpt-3.5-turbo}} --message {{user "Hello world"}}
Create a chat completion:
tar
View Details ▼
tar
Archiving utility.
Often combined with a compression method, such as `gzip` or `bzip2`.
tar cf {{path/to/target.tar}} {{path/to/file1 path/to/file2 ...}}
[c]reate an archive and write it to a [f]ile:
tar czf {{path/to/target.tar.gz}} {{path/to/file1 path/to/file2 ...}}
[c]reate a g[z]ipped archive and write it to a [f]ile:
tar czf {{path/to/target.tar.gz}} {{[-C|--directory]}} {{path/to/directory}} .
[c]reate a g[z]ipped (compressed) archive from a directory using relative paths:
gemma3
View Details ▼
gemma3
The examples for this command have been moved together with `inference-snap`.
tldr inference-snap
View documentation for `inference-snap`:
