Use this skill whenever the user needs to operate a Kubernetes cluster — list/inspect pods, deployments, statefulsets, daemonsets, replicasets, jobs, cronjobs, services, ingresses, endpoints, configmaps, secrets (names/keys only), PVCs/PVs/storageclasses, nodes, namespaces, and events; read pod logs; describe pods/nodes; pod/node top (metrics); read-only diagnostics / RCA (pod-health, workload-readiness); scale deployments/statefulsets; rollout status/history/undo/pause/resume and set image; delete pods/deployments/jobs; create/delete namespaces; and cordon/uncordon/drain nodes. Works with any kubeconfig-reachable cluster (standard Kubernetes, k3s, EKS, GKE, AKS). Always use this skill for "list k8s pods", "scale deployment", "kubernetes pod logs", "describe pod", "why is my pod crashing", "diagnose pods", "which deployments are unhealthy", "rollout undo", "set image", "top pods", "drain node", "cordon node", "restart deployment", "k3s", or "kubectl"-style tasks when the context is exp
编程
K8s
试用Operate Kubernetes clusters via kubectl with a user-supplied kubeconfig (local file path or remote URL). This skill should be used when users want to inspect...
它能做什么
Operate Kubernetes clusters via kubectl with a user-supplied kubeconfig (local file path or remote URL). This skill should be used when users want to inspect or manage Kubernetes resources (pods, deployments, services, nodes, namespaces, logs, exec, apply, etc.) against an arbitrary cluster. The skill auto-downloads remote kubeconfigs to a cached location and auto-installs `kubectl` if it is missing.
技能文档
Kubernetes (k8s) Skill
Run kubectl against any cluster by pointing at a local kubeconfig file or a remote kubeconfig URL. Bootstrap (kubectl install + kubeconfig download) is handled automatically.
When to Use
Use this skill whenever the user wants to:
- Inspect Kubernetes resources (e.g.
kubectl get pods -A,kubectl describe node ...) - Apply / delete / edit manifests (
kubectl apply -f,kubectl delete,kubectl rollout) - Stream logs, exec into pods, port-forward, or run any other
kubectlsubcommand - Run against a one-off cluster whose kubeconfig is published at an HTTP(S) URL
Usage
The main entry point is scripts/k8s.sh. It is a thin wrapper that:
- Ensures
kubectlis installed (downloads it via the DaoCloud mirror if missing). - Resolves the kubeconfig (downloads it to a cached path if a URL is given).
- Invokes
kubectl --kubeconfig=.
Local kubeconfig
bash scripts/k8s.sh \
--kubeconfig /path/to/kubeconfig.yaml \
-- get pods -A
Remote kubeconfig URL
bash scripts/k8s.sh \
--kubeconfig-url https://example.com/kubeconfig.yaml \
-- get nodes -o wide
Via environment variables
--kubeconfig and --kubeconfig-url can also be supplied via env vars:
export KUBECONFIG_URL=https://example.com/kubeconfig.yaml
bash scripts/k8s.sh -- get ns
Or:
export KUBECONFIG_PATH=/path/to/kubeconfig.yaml
bash scripts/k8s.sh -- get ns
If both a URL and a local path are provided, the explicit CLI flag wins; otherwise local path takes precedence over URL.
The -- separator
Anything after -- is forwarded verbatim to kubectl. The separator is recommended (especially when forwarded args start with -), but the script also tolerates omitting it when no flag ambiguity exists.
Flags
| Flag | Env Var | Description |
|---|---|---|
--kubeconfig | KUBECONFIG_PATH | Local kubeconfig file path. |
--kubeconfig-url | KUBECONFIG_URL | Remote kubeconfig URL (http/https). Downloaded once and cached. |
--cache-dir | K8S_SKILL_CACHE_DIR | Cache directory for downloaded kubeconfigs and kubectl binary. Defaults to $HOME/.cache/k8s-skill. |
--refresh | - | Force re-download of the remote kubeconfig even if cached. |
--kubectl | KUBECTL_BIN | Use a specific kubectl binary instead of auto-detect/install. |
--insecure | - | Pass -k to curl when downloading the kubeconfig (use only for trusted self-signed endpoints). |
-h, --help | - | Print usage. |
All other arguments (or anything after --) are passed straight through to kubectl.
Examples
# List namespaces using a local kubeconfig
bash scripts/k8s.sh --kubeconfig ~/.kube/prod.yaml -- get ns
# Tail logs against a remote kubeconfig
bash scripts/k8s.sh \
--kubeconfig-url https://example.com/kubeconfig.yaml \
-- logs -n kube-system -l k8s-app=kube-dns --tail=100 -f
# Apply a manifest
bash scripts/k8s.sh \
--kubeconfig-url https://example.com/kubeconfig.yaml \
-- apply -f ./deploy.yaml
# Force a kubeconfig refresh (re-download)
bash scripts/k8s.sh \
--kubeconfig-url https://example.com/kubeconfig.yaml --refresh \
-- cluster-info
Behavior Notes
- kubectl auto-install: When
kubectlis missing and no--kubectl/KUBECTL_BINoverride is given, the wrapper downloads a stablekubectlbinary for the current OS/arch from the DaoCloud mirror (https://files.m.daocloud.io/dl.k8s.io/...) and caches it under/bin/kubectl. The cache directory is added toPATHfor the duration of the command. - Kubeconfig caching: Remote kubeconfigs are hashed by URL (sha256) and stored at
/kubeconfigs/.yaml. Use--refreshto bypass the cache. - Secrets: Downloaded kubeconfigs are written with
chmod 600. Avoid logging the file contents. - Cross-platform: The wrapper auto-detects Linux/macOS and amd64/arm64 for kubectl downloads.
- Errors: If both kubeconfig sources are missing the script exits with a clear error. Curl/network errors are surfaced verbatim.
Quick Sanity Check
A no-op connectivity probe:
bash scripts/k8s.sh \
--kubeconfig-url https://example.com/kubeconfig.yaml \
-- version --short
相关技能
Kubernetes operations plugin — 32 tools for cluster management, monitoring, troubleshooting, and security auditing
Kustomer (kustomer.com). Use this skill for ANY Kustomer request — reading, creating, and updating data. Whenever a task involves Kustomer, use this skill in...
Kernel (kernel.sh). Use this skill for ANY Kernel request — reading, creating, updating, and deleting data. Whenever a task involves Kernel, use this skill i...
1Panel operation skill for agent runtimes. Use when the user wants an assistant to interact with a 1Panel instance for resource monitoring, websites, certifi...
以 kubectl 为先的分诊流程诊断 Kubernetes 工作负载故障并审查清单,判断全部落在本地笔记上。