Skip to content

Add PowerShell installer and Windows setup instructions to README #184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,39 @@ chmod a+x kubectl-ai
sudo mv kubectl-ai /usr/local/bin/
```

#### Installation on Windows (PowerShell)

```powershell
# Download precompiled Windows binary:
Invoke-WebRequest -Uri https://github.com/GoogleCloudPlatform/kubectl-ai/releases/latest/download/kubectl-ai_windows_amd64.exe -OutFile kubectl-ai.exe
# Or build locally with the script:
.\install.ps1 -OutputPath .\kubectl-ai.exe
# (Optional) Move the executable to a directory in your PATH:
Move-Item .\kubectl-ai.exe -Destination $Env:ProgramFiles\kubectl-ai\kubectl-ai.exe
```

### Environment Variable Configuration

#### Environment Variable Configuration (PowerShell)

```powershell
# Gemini (Google AI Studio) – persistent & global:
setx GEMINI_API_KEY "your_api_key_here" -m
echo $Env:GEMINI_API_KEY

# OpenAI (or Azure OpenAI) – persistent & global:
setx OPENAI_API_KEY "your_openai_api_key_here" -m
echo $Env:OPENAI_API_KEY

# (Optional) For Azure OpenAI – persistent:
setx OPENAI_ENDPOINT "https://your_azure_openai_endpoint/" -m
echo $Env:OPENAI_ENDPOINT

# Grok (X.AI) – persistent & global:
setx GROK_API_KEY "your_xai_api_key_here" -m
echo $Env:GROK_API_KEY
```

### Usage

#### Using Gemini (Default)
Expand Down
25 changes: 25 additions & 0 deletions install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<#
.SYNOPSIS
Builds kubectl-ai for Windows (amd64).
.DESCRIPTION
This script sets GOOS and GOARCH and runs 'go build'.
.PARAMETER OutputPath
Output path for the executable (default '.\kubectl-ai.exe').
.EXAMPLE
.\install.ps1 -OutputPath .\kubectl-ai.exe
#>
param(
[string]$OutputPath = ".\kubectl-ai.exe"
)

Write-Host "Building kubectl-ai for Windows (GOOS=windows, GOARCH=amd64)..."
$env:GOOS = "windows"
$env:GOARCH = "amd64"

go build -o $OutputPath .
if ($LASTEXITCODE -eq 0) {
Write-Host "Build succeeded: $OutputPath"
} else {
Write-Error "Build failed with exit code: $LASTEXITCODE"
exit 1
}