编程

vmware-vks

试用

用自然语言管理 vSphere Kubernetes Service 的 Supervisor 集群、命名空间与 TKC 集群生命周期。

它能做什么

提供 23 个 MCP 工具与对应 CLI,覆盖 vSphere 8.x 上的 VKS 平台层。可检查 VKS 兼容性、列出 Supervisor 存储策略、对带资源配额的 vSphere Namespace 进行 CRUD、对 TanzuKubernetesCluster(TKC)执行创建/扩缩容/升级/删除、取回 Supervisor 与 TKC 的 kubeconfig、查询 Harbor 仓库信息与命名空间存储用量;另外附带对 VM Service 的只读查询(快照、VM 组、多网卡读数)。所有写入操作默认 dry-run,先返回 YAML 计划再真正下发;删除操作需要显式确认,并在仍有 TKC 或运行中工作负载时直接拒绝。kubeconfig 命令产出短期会话令牌,建议写入本地文件供 kubectl 使用,而不是回显到对话上下文中。

什么时候用它

  • 校验目标 vCenter 的 VKS / Workload Management 兼容性
  • 创建或更新带 CPU、内存、存储配额的 Supervisor Namespace
  • 部署、扩缩容或升级 TanzuKubernetesCluster(TKC)
  • 取回 Supervisor 或 TKC 的 kubeconfig

技能文档

VMware VKS

Disclaimer: This is a community-maintained open-source project and is not affiliated with, endorsed by, or sponsored by VMware, Inc. or Broadcom Inc. "VMware" and "vSphere" are trademarks of Broadcom. Source code is publicly auditable at github.com/vmware-skills/VMware-VKS under the MIT license.

AI-powered VMware vSphere Kubernetes Service (VKS) management — 23 MCP tools.

Requires vSphere 8.x+ with Workload Management enabled. Companion skills: vmware-aiops (VM lifecycle), vmware-monitor (monitoring), vmware-storage (storage), vmware-nsx (NSX networking), vmware-nsx-security (DFW/firewall), vmware-aria (metrics/alerts/capacity), vmware-avi (AVI/ALB/AKO), vmware-harden (compliance baselines). | vmware-pilot (workflow orchestration) | vmware-policy (audit/policy)

What This Skill Does

CategoryCapabilitiesCount
SupervisorCompatibility check, status, storage policies3
NamespaceList, get, create with quotas, update, delete with TKC guard, VM classes6
TKC ClustersList, get, versions, create, scale, upgrade, delete with workload guard7
VM ServiceVM snapshots, VM groups + bootOrder, VM multi-NIC readout (vm-operator CRDs, read-only)3
AccessSupervisor kubeconfig, TKC kubeconfig, Harbor registry, storage usage4

Quick Install

uv tool install vmware-vks
vmware-vks check

When to Use This Skill

  • Check if vSphere environment supports VKS
  • Create, update, or delete Supervisor Namespaces with resource quotas
  • Deploy, scale, upgrade, or delete TKC (TanzuKubernetesCluster) clusters
  • Get kubeconfig for Supervisor or TKC clusters
  • Check Harbor registry info or storage usage

Use companion skills for:

  • VM lifecycle, deployment → vmware-aiops
  • Inventory, health, alarms → vmware-monitor
  • iSCSI, vSAN, datastore → vmware-storage
  • Load balancing, AVI/ALB, AKO, Ingress → vmware-avi
User IntentRecommended Skill
Read-only monitoringvmware-monitor
Storage: iSCSI, vSANvmware-storage
VM lifecycle, deploymentvmware-aiops
vSphere Kubernetes Service (vSphere 8.x+)vmware-vks ← this skill
NSX networking: segments, gateways, NATvmware-nsx
NSX security: DFW rules, security groupsvmware-nsx-security
Aria Ops: metrics, alerts, capacity planningvmware-aria
Multi-step workflows with approvalvmware-pilot
Compliance baselines (CIS / 等保 / PCI-DSS), drift detection, LLM remediation advisorvmware-harden (uv tool install vmware-harden)
Load balancer, AVI, ALB, AKO, Ingressvmware-avi (uv tool install vmware-avi)
Audit log queryvmware-policy (vmware-audit CLI)

Common Workflows

Deploy a New TKC Cluster

Pre-flight (judgment):

  • Supervisor must be vSphere 8.x+ with WCP enabled — supervisor check returns pass/fail. If fail, no amount of TKC commands will work; resolve at vSphere/WCP layer first.
  • K8s version: pick a TKR version that's still supported by VMware (not EOL). New clusters on EOL versions look fine until you need a CVE patch and there isn't one.
  • VM class sizing: best-effort-* for dev, guaranteed-* for prod. A best-effort worker can be evicted under host pressure — production workloads need guaranteed.
  • Storage policy: must already exist in vCenter. list_supervisor_storage_policies first and pass the returned policy ID (not the display name); creating a TKC against a missing policy fails after CP boot, leaving partial state.
  • Control-plane count: 1 for dev, 3 for prod (HA). Cannot upgrade from 1→3 without recreating; choose right the first time.
  • Namespace quota: TKC consumes CP + worker × (cpu, memory) from namespace quota. If quota is too tight, workers fail to schedule with no obvious error.
  • TKC API version: auto-detected at runtime via the K8s discovery API (prefers cluster.x-k8s.io/v1 when the Supervisor serves it, falls back to v1beta1 on vSphere 8.0). No manual selection needed; advanced callers can override via the api_version parameter on generate_tkc_yaml().

Steps:

  1. vmware-vks supervisor check --target prod → must pass
  2. vmware-vks tkc versions -n → pick a non-EOL TKR
  3. (If new namespace) vmware-vks namespace create dev --storage-policy --cpu --apply --dry-run then real
  4. vmware-vks tkc create dev-cluster -n dev --version --control-plane 1 --workers 3 --vm-class best-effort-large --apply --dry-run then real
  5. Wait for phase=running (typically 10-15 min); do not assume success on apply return
  6. vmware-vks kubeconfig get dev-cluster -n dev -o ./kubeconfig — write to file, do not paste tokens into the agent context

Scale Workers for Load Testing

Judgment: scaling is fast but reverse-scaling is destructive — workers are deleted, in-flight pods lost. Treat scale-down like a delete.

  1. tkc get dev-cluster -n dev → record current worker count and any pending pods
  2. Scale-up: tkc scale dev-cluster -n dev --workers 6 → safe, additive operation
  3. Verify new workers reach Ready in kubectl get nodes before sending traffic
  4. Scale-down: drain pods first via kubectl drain on the to-be-deleted nodes, THEN tkc scale --workers 3. Skipping drain causes pod restarts on remaining nodes — measurable user impact.
  5. Confirm namespace quota leftover supports the new size — quota is enforced at scheduling, not at scale request

Namespace Resource Management

Judgment: quota changes are atomic but consequences are not. Reducing quota below current usage doesn't evict pods — they keep running, but no new pods schedule, looking like a "namespace is broken" symptom.

  1. namespace list → see all namespaces and their phase
  2. storage -n dev → check current CPU/memory/storage usage; never reduce quota below current usage + 20% headroom
  3. namespace update dev --cpu --memory --dry-run → preview, then real
  4. Validate by attempting a small pod scale-up; if it pends with Insufficient cpu, quota is still the bottleneck

Architecture

User (Natural Language)
  ↓
AI Agent (Claude Code / Goose / Cursor)
  ↓ reads SKILL.md
  ↓
vmware-vks CLI  ─── or ───  vmware-vks MCP Server (stdio)
  │
  ├─ Layer 1: pyVmomi → vCenter REST API
  │   Supervisor status, storage policies, Namespace CRUD, VM classes, Harbor
  │
  └─ Layer 2: kubernetes client → Supervisor K8s API endpoint
      TKC CR apply / get / delete  (cluster.x-k8s.io/v1beta1)
      Kubeconfig bearer token from POST /wcp/login (Supervisor JWT)
  ↓
vCenter Server 8.x+ (Workload Management enabled)
  ↓
Supervisor Cluster → vSphere Namespaces → TanzuKubernetesCluster

Usage Mode

ScenarioRecommendedWhy
Local/small models (Ollama, Qwen)CLI~2K tokens vs ~8K for MCP
Cloud models (Claude, GPT-4o)EitherMCP gives structured JSON I/O
Automated pipelinesMCPType-safe parameters, structured output

MCP Tools (23 — 16 read, 7 write)

All accept optional target parameter to specify a named vCenter.

list_namespaces, list_supervisor_storage_policies and list_vm_classes return the family list envelope — {items, returned, limit, total, truncated, hint} — rather than a bare array. Read the rows from items; truncated says whether the listing is complete, so it never has to be guessed from the row count. These three read their collection in one un-paged call, so total is the real count and truncated is always false.

CategoryToolType
Supervisorcheck_vks_compatibilityRead
get_supervisor_statusRead
list_supervisor_storage_policiesRead
Namespacelist_namespacesRead
get_namespaceRead
create_namespaceWrite
update_namespaceWrite
delete_namespaceWrite
list_vm_classesRead
TKClist_tkc_clustersRead
get_tkc_clusterRead
get_tkc_available_versionsRead
create_tkc_clusterWrite
scale_tkc_clusterWrite
upgrade_tkc_clusterWrite
delete_tkc_clusterWrite
VM Servicelist_vm_snapshotsRead
list_vm_groupsRead
list_vm_network_interfacesRead
Accessget_supervisor_kubeconfigRead
get_tkc_kubeconfigRead
get_harbor_infoRead
list_namespace_storage_usageRead

create_namespace / create_tkc_cluster — defaults to dry_run=True, returns a YAML plan for review. Pass dry_run=False to apply.

delete_namespace — requires confirmed=True and rejects if TKC clusters still exist (prevents orphaned clusters).

delete_tkc_cluster — requires confirmed=True and checks for running workloads. Rejects if found unless force=True.

Credential handling: get_supervisor_kubeconfig and get_tkc_kubeconfig return short-lived session tokens (not long-lived credentials). Tokens are derived from the authenticated vCenter session and expire when the session ends. Kubeconfig output is intended for local kubectl use — agents should write it to a file (-o ) rather than displaying tokens in conversation context.

Full capability details and safety features: see references/capabilities.md

CLI Quick Reference

# Supervisor
vmware-vks check [--target ]
vmware-vks preflight-auth [--target ]   # live-validate POST /wcp/login (issue #13)
vmware-vks supervisor status  [--target ]
vmware-vks supervisor storage-policies [--target ]

# Namespace
vmware-vks namespace list [--target ]
vmware-vks namespace get  [--target ]
vmware-vks namespace create  --cluster  [--cpu ] [--memory ] [--storage-policy ] [--apply]
vmware-vks namespace update  [--cpu ] [--memory ] [--target ]
vmware-vks namespace delete  [--target ]

# TKC Clusters
vmware-vks tkc list [-n ] [--target ]
vmware-vks tkc create  -n  [--version ] [--workers ] [--vm-class ] [--apply]
vmware-vks tkc scale  -n  --workers  [--pool ] [--target ]
vmware-vks tkc upgrade  -n  --version  [--target ]
vmware-vks tkc delete  -n  [--skip-workload-check] [--target ]

# Kubeconfig
vmware-vks kubeconfig supervisor -n  [--target ]
vmware-vks kubeconfig get  -n  [-o ] [--target ]

# Harbor & Storage
vmware-vks harbor [--target ]
vmware-vks storage -n  [--target ]

Full CLI reference with all flags and interactive creation: see references/cli-reference.md

Troubleshooting

"VKS not compatible" error

Workload Management must be enabled in vCenter. Check: vCenter UI → Workload Management. Requires vSphere 8.x+ with Enterprise Plus or VCF license.

Namespace creation fails with "storage policy not found"

List policies first: vmware-vks supervisor storage-policies, then pass the Policy ID column value (not the display name) as --storage-policy.

TKC cluster stuck in "Creating" phase

Check Supervisor events in vCenter. Common causes: insufficient resources on ESXi hosts, network issues with NSX-T, or storage policy not available on target datastore.

Validating Supervisor auth (POST /wcp/login)

Supervisor/TKC Kubernetes auth uses a JWT obtained from POST https:///wcp/login (HTTP Basic → JSON session_id bearer token), not the pyVmomi SOAP session key. To validate this end-to-end against your real Supervisor, run:

vmware-vks preflight-auth [--target ]

It performs the real login (no mocks) and reports, per target: vCenter reachable → /wcp/login HTTP status → parseable session_id → does the JWT authenticate a trivial Supervisor K8s API call. A healthy result is all four steps ✓ PASS ending in target '': /wcp/login auth flow validated end-to-end. (exit code 0). On failure each step prints a teaching message — e.g. a 404 on /wcp/login means the endpoint path differs on your Supervisor version (capture the real path), a 401 on the K8s probe means session_id is not the bearer token on your version. It never tracebacks — every failure is status output.

Kubeconfig retrieval fails

Supervisor API endpoint must be reachable from the machine running vmware-vks. Check firewall rules for port 6443.

Scale operation has no effect

Verify the cluster is in "Running" phase before scaling. Clusters in "Creating" or "Updating" phase reject scale operations.

Delete namespace rejected unexpectedly

The namespace delete guard prevents deletion when TKC clusters exist inside. Delete all TKC clusters in the namespace first, then retry.

Prerequisites

  • vSphere 8.x+ with Workload Management enabled
  • Enterprise Plus or VCF license
  • NSX-T (recommended) or VDS + HAProxy networking
  • Supervisor Cluster configured and running

Setup

uv tool install vmware-vks
mkdir -p ~/.vmware-vks
vmware-vks init

All tools are automatically audited via vmware-policy. Audit logs: vmware-audit log --last 20

Full setup guide, security details, and AI platform compatibility: see references/setup-guide.md

Audit & Safety

All operations are automatically audited via vmware-policy (@vmware_tool decorator):

  • Every tool call logged to ~/.vmware/audit.db (SQLite, framework-agnostic) with a local JSON-Lines mirror at ~/.vmware-vks/audit.log
  • Policy rules enforced via ~/.vmware/rules.yaml (deny rules, maintenance windows, risk levels)
  • Risk classification: each tool tagged as low/medium/high/critical
  • View recent operations: vmware-audit log --last 20
  • View denied operations: vmware-audit log --status denied

In-memory kubeconfig (v1.5.18+): kubeconfig for the Supervisor and TKC clusters — which embeds the vCenter session bearer token — is built as a Python dict and loaded into the kubernetes client via load_kube_config_from_dict(). The token never touches disk during normal MCP/CLI flow, eliminating the previous temp-file TOCTOU window. The explicit kubeconfig get -o CLI export still writes to the user-chosen path for kubectl use.

vmware-policy is automatically installed as a dependency — no manual setup needed.

License

MIT — github.com/vmware-skills/VMware-VKS

常见问题

对 vSphere 版本有什么要求?
需要 vSphere 8.x 及以上,并启用 Workload Management,同时具备 Enterprise Plus 或 VCF 许可证。
破坏性操作如何避免误执行?
创建类操作默认 dry-run,先返回 YAML 计划;Namespace 与 TKC 的删除需显式确认,并在仍存在 TKC 或运行中工作负载时直接拒绝。
CLI 模式和 MCP 模式有什么差别?
两者覆盖同一套 23 个工具。CLI 上下文占用小,适合本地或较小模型;MCP 提供类型安全的 JSON 输入输出,更适合云端模型与自动化流水线。

相关技能

在本地磁盘以分类纯 Markdown 文件保存需要长期留存的事实,与智能体内置记忆并存。

作者 Iván559 次安装18 星标

把自然语言描述转为结构化 JSON,并由 mcp-diagram-generator MCP 服务生成 Draw.io、Mermaid 或 Excalidraw 图表文件。

作者 nssa.io1.0k 次安装47 星标

以 AI 机器人身份加入视频会议,提供语音、虚拟形象与屏幕共享四种模式。

作者 johnpatternai22 次安装8 星标

诊断生产力系统反复失效的根因,给出最小干预——容量测算、瓶颈定位、可靠的本地记录。

作者 Iván855 次安装69 星标

从 AdMapix API 拉取广告创意、应用、榜单和收入预估等数据,原样返回结构化 JSON。

作者 fly0pants4.3k 次安装296 星标

执行 Git 操作(提交、分支、合并、变基、冲突解决与恢复)时强制套用安全规则。

作者 Iván535 次安装31 星标

zw008 的更多技能

浏览全部技能

通过 33 个 MCP 工具查询 VMware Aria Operations 的指标、告警、容量、异常与报告。

作者 zw00853 次安装

通过 21 个 MCP 工具或配套 CLI,管理 NSX-T 分布式防火墙策略、安全组、VM 标签、Traceflow 与 IDPS。

作者 zw00854 次安装

用 28 个读写工具管理 AVI 虚拟服务、AKO Ingress 与后端成员,覆盖 NSX ALB 运维场景。

作者 zw00851 次安装

通过 33 个 CLI/MCP 工具管理 NSX-T 网段、Tier-0/Tier-1 网关、NAT、静态路由与 IP 池。

作者 zw00850 次安装

为 VMware 多步操作设计审批流程、追踪状态、失败时自动回滚的统一编排入口。

作者 zw00824 次安装1 星标

针对 vSphere/ESXi/NSX 环境的合规扫描与基线比对,覆盖 CIS、STIG、等保 2.0 三级、PCI-DSS、IT-Grundschutz、NIS2。

作者 zw00834 次安装