DeepSHPlugins
dsh-kubernetes 项目预览
GITHUB / COMMUNITY PROJECT

dsh-kubernetes

工具与集成

面向 DeepSeek Harness 的安全 Kubernetes 能力,支持工作负载检查、有限日志与事件获取、故障诊断以及带审批控制的集群操作。

1 Starsxxiaoxiong
访问 GitHub 仓库
dsh-kubernetes 项目预览

项目介绍

中文

面向 DeepSeek Harness 的安全 Kubernetes 能力,支持工作负载检查、有限日志与事件获取、故障诊断以及带审批控制的集群操作。

English

Safe Kubernetes capability for DeepSeek Harness with workload inspection, bounded logs and events, failure diagnosis, and approval-gated operations.

项目信息与收录信号

快照 2026-09-11
作者 / 组织
xxiaoxiong
仓库
xxiaoxiong/dsh-kubernetes
GitHub Stars
1
Forks
未记录
开发语言
未记录
许可证
未记录
最近推送
未记录
Manifest
数据中检测到声明

公开仓库不自动等于可商用;许可证与当前兼容性以原项目文档为准。Manifest 和数据评分不构成安装安全认证。

数据评分

30/ 100
维护活跃
10
文档与实用信息
85
生态关注度
9
安装便捷信号
100
项目声明信号
65

README 含完整安装与使用说明;关注度尚低(1);标准命令一键安装。

评分来自已有数据快照的五维模型,仅作浏览参考,不是实际使用评测或安全检测结论。

安装与使用

所有项目资料与许可均以对应 GitHub 仓库为准。

dsh plugin --profile web add dsh-kubernetes

复制命令不会自动执行。请先阅读仓库文档,确认环境要求与许可证。

项目截图

仓库 README

GitHub 原文

已保存的仓库文档快照;文档抓取时间未记录,可能与上方目录介绍处于不同版本。安装前请核对当前仓库说明。

dsh-kubernetes

dsh-kubernetes gives DeepSeek Harness a safe Kubernetes capability: inspect workloads, retrieve bounded logs and events, diagnose common failures, and perform approval-gated changes.

A community plugin for DeepSeek Harness (DSH). It is not a kubectl wrapper — it turns Kubernetes into a structured, Agent-friendly runtime capability with a read-first security model.

DSH Agent
   ↓
Generic Kubernetes Tools (10)
   ↓
ctx.kubernetes capability service
   ↓
KubernetesService (policy · diagnosis · bounding)
   ↓
KubernetesClientProvider (@kubernetes/client-node)
   ↓
Kubernetes API

Highlights

  • Read-first by default — readOnly: true out of the box. Real writes require explicit opt-in and survive the DSH approval gate.
  • 10 structured tools — every tool returns JSON with a schema plus a compact text rendering; no fragile CLI output parsing.
  • k8s_diagnose evidence engine — walks Deployment/StatefulSet → Pods → containers → events → bounded logs and classifies likely failure categories (CrashLoopBackOff, ImagePullBackOff, OOMKilled, probe failures, …). No inner LLM: the plugin collects evidence, the DSH Agent reasons.
  • Bounded, sanitized logs — tailLines / sinceSeconds / container / previous / maxChars with hard caps. Logs are UNTRUSTED DATA: secret-shaped values are redacted, ANSI/control characters stripped.
  • Secrets never leak — k8s_describe secret returns metadata, type and data keys only. Credential-shaped fields (token, password, client-key-data, service-account tokens, container env secrets, …) are redacted everywhere.
  • Controlled k8s_apply — server-side dry-run by default; real applies are denied under read-only policy, or escalated to approval (ask) when writes are enabled, with cluster/namespace context and production-risk warnings in the reason.

Installation

dsh plugin add dsh-kubernetes          # from npm (once published)
# or from a packed tarball:
npm pack
dsh plugin add ./dsh-kubernetes-0.1.0.tgz

Library use outside DSH also works — the package exports a host-agnostic API:

import { KubernetesClientProvider, DiagnosisEngine, KubernetesService } from 'dsh-kubernetes';

Configuration

The plugin resolves kubeconfig with standard priority: explicit kubeconfigPath → KUBECONFIG env → ~/.kube/config → in-cluster service account. Context is never switched silently.

OptionDefaultDescription
readOnlytrueRead-only mode. Disables real writes even if allowWrite is true.
allowWritefalseMaster switch for write operations. Real applies additionally require approval.
context–Explicit kubeconfig context override.
namespacecontext namespace / defaultDefault namespace override.
kubeconfigPath–Explicit kubeconfig file path.
maxLogChars8000Hard cap of characters per log excerpt (500–20000).
maxLogTailLines200Hard cap of tail lines per log request (1–500).
maxLogSinceSeconds3600Hard cap of the log time window in seconds (10–21600).

Profile example — the plugin's bundled cordis.patch.yml inserts itself with safe defaults automatically; override by id in your own profile layer if needed:

- id: dsh-kubernetes
  config:
    readOnly: true
    allowWrite: false

Tools

ToolAccessWhat it does
k8s_contextreadActive context, cluster server, effective namespace, capabilities, all contexts (no credentials).
k8s_namespacesreadNamespaces with phase.
k8s_workloadsreadDeployments/StatefulSets/DaemonSets with replicas + health, unhealthy-first.
k8s_podsreadPods with phase, health, restarts, container waiting reasons (cap 200).
k8s_describereadSanitized resource describe. Secrets: metadata/type/data keys only.
k8s_logsreadBounded, sanitized, de-duplicated pod logs.
k8s_eventsreadEvents (optionally scoped to a resource), sanitized + bounded.
k8s_diagnosereadStructured DiagnosisEvidence with likely failure categories.
k8s_rolloutreadRollout status for a workload.
k8s_applygatedServer-side dry-run apply by default; real apply needs allowWrite and approval.

Security model

readOnly=true (default)      readOnly=false + allowWrite=true
────────────────────────     ─────────────────────────────────
get/list/describe  ✓         get/list/describe          ✓
logs/events        ✓         logs/events                ✓
apply dryRun=true  ✓         apply dryRun=true          ✓
apply dryRun=false ✗ deny    apply dryRun=false         → approval (ask)
  • Write operations bind explicitly to context / cluster / namespace / resource and show them before approval.
  • Contexts named like prod/production/prd raise the risk level in the approval reason (string match is a hint, never proof of safety).
  • No delete, exec, port-forward, scale, restart or rollback tools in v1 — by design.
  • kubeconfig contents, tokens, client keys and certificates never enter tool results or the session.

Diagnosis demo

User: Why does production/order-service keep restarting?

Agent → k8s_diagnose(Deployment/order-service)

Evidence:
- deployment: 3 desired / 1 ready — progressing
- pods: 3 total; 2× CrashLoopBackOff (unhealthy)
- containers: last termination OOMKilled (exit 137), restarts 14
- memory limit: 512Mi on all containers
- relevant events: BackOff ×14 (Warning)
- bounded logs (tail 40, redacted): "OOMkilled while serving traffic"
- likelyCategories: ["crash-loop", "oom-killed"]

The plugin marks categories as *likely*, never as certain facts — final reasoning stays with the DSH Agent.

Dry-run / approval demo

Agent → k8s_apply(manifest, dryRun=true)
Result: applied (server-side dry-run): ConfigMap/order-service-config (namespace default)

User: looks good, apply it for real

Agent → k8s_apply(manifest, dryRun=false)
Approval request (ask):
  k8s_apply with dryRun=false targets context "kind-dsh-e2e" (namespace "default").
  Approve to perform the real change.

Under the default read-only policy the same call is denied outright:

{ kind: "deny", reason: "real apply denied: plugin is read-only (readOnly=true, allowWrite=false). Set allowWrite=true and readOnly=false to enable approval-gated writes." }

Compatibility

ComponentTested with
DeepSeek Harness plugin API@deepseek-ai/dsh-tools 0.1.0-rc.6
Cordis runtime@deepseek-ai/cordis 4.0.1
Kubernetes client@kubernetes/client-node 1.4.0
Kubernetes clusterkind v1.32.2 (E2E), standard API groups core/v1, apps/v1
Node.js≥ 18.18 (tested on 22.x)

Known limitations

  • v1 targets standard Kubernetes only (OpenShift / EKS/GKE/AKS-specific auth flows untested; standard kubeconfig works).
  • k8s_apply performs server-side apply for create/update; no delete, no exec, no port-forward, no scale/rollback tools.
  • Rollout status is computed for Deployment/StatefulSet/DaemonSet; other kinds return unknown.
  • Log redaction uses pattern heuristics — exhaustive secret detection is not guaranteed.
  • CRDs are not listed by k8s_workloads (core workload kinds only); k8s_describe works for arbitrary kinds.

Uninstall

dsh plugin remove dsh-kubernetes

All service/tool registrations are attached to the plugin fiber — removal rolls them back completely, with no residual listeners or processes.

Development

npm install
npm run lint        # tsc --noEmit
npm test            # 105 unit + mock-API + contract + cordis tests
npm run build

# Real-cluster E2E (throwaway cluster only):
kind create cluster --name dsh-e2e
DSH_K8S_E2E=1 npm run test:e2e

License

MIT

使用前核对

安装步骤、兼容版本与授权范围以原项目当前文档为准。Stars 和评分是快照中的导航信号。

安装与排错 · 项目问题反馈

同类项目