Metadata-Version: 2.4
Name: sanjiu-k8s-cli
Version: 0.1.0
Summary: A KubeSphere K8s CLI tool for viewing pods, logs, and deployment status
License-Expression: MIT
Requires-Python: >=3.11
Requires-Dist: click>=8.0
Requires-Dist: httpx>=0.28.0
Provides-Extra: dev
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Description-Content-Type: text/markdown

# sj-k8s

A CLI tool for managing K8s clusters via KubeSphere API. Designed for environments where you only have KubeSphere web console access (no kubectl/SSH).

## Features

- **Auto login** with KubeSphere's encrypted authentication (LDAP supported)
- **Token caching** — only re-authenticates when token expires
- **Multi-cluster** support with auto-discovery
- **View pods, deployments, logs** without kubectl access

## Install

```bash
pip install sanjiu-k8s-cli
```

## Configuration

Create `~/.k8s-cli`:

```
KS_URL=https://your-kubesphere.example.com
KS_USER=your-username
KS_PASSWORD=your-password
```

Or use environment variables: `KS_URL`, `KS_USER`, `KS_PASSWORD`.

## Usage

```bash
# Verify authentication
sj-k8s auth

# List clusters
sj-k8s clusters

# List pods (specify cluster with -c)
sj-k8s -c dev-local pods my-namespace

# Deployment status
sj-k8s -c dev-local status my-namespace my-deployment

# View logs
sj-k8s -c dev-local logs my-namespace my-pod -n 50

# Stream logs
sj-k8s -c dev-local logs my-namespace my-pod -f

# List deployments
sj-k8s -c dev-local deploys my-namespace

# Pod details
sj-k8s -c dev-local describe my-namespace my-pod
```

## Claude Code Integration

This CLI is designed to be used with [Claude Code](https://claude.ai/code) as an AI-powered K8s operations assistant. A skill file is included in `skill/SKILL.md` — copy it to `~/.claude/skills/sj-k8s/SKILL.md` to enable natural language K8s operations.

## License

MIT
