$npx -y skills add kubesphere/kubesphere --skill kubesphere-openkruiseKubeSphere OpenKruise management Skill. Use when user asks to install or enable OpenKruise, check OpenKruise status, view kruise pods/logs/CRDs, create or update SidecarSet, manage sidecar injection, create or update CloneSet, perform in-place update or batch rollout, uninstall o
| 1 | # Skill: kubesphere-openkruise |
| 2 | |
| 3 | # KubeSphere OpenKruise Management |
| 4 | |
| 5 | Use this skill for the full OpenKruise lifecycle in KubeSphere: |
| 6 | |
| 7 | - Install or upgrade the OpenKruise extension through `InstallPlan` |
| 8 | - Query extension status, CRDs, Pods, and logs |
| 9 | - Generate `SidecarSet` manifests for sidecar injection and rolling updates |
| 10 | - Generate `CloneSet` manifests for advanced stateless workloads, in-place updates, and batch rollout |
| 11 | - Uninstall the OpenKruise extension |
| 12 | - Troubleshoot failed Pods, missing CRDs, and webhook problems |
| 13 | |
| 14 | Out of scope by default: |
| 15 | |
| 16 | - Advanced OpenKruise CRDs not requested by the user, such as `BroadcastJob`, `NodeImage`, `UnitedDeployment`, or `AdvancedPodAutoscaler` |
| 17 | - Deep chart-value design without cluster evidence |
| 18 | |
| 19 | If the user explicitly asks for those CRDs, acknowledge that they are OpenKruise capabilities but treat them as a follow-up task instead of assuming they belong in the default workflow. |
| 20 | |
| 21 | ## Response Rules |
| 22 | |
| 23 | - Prefer executable output: `InstallPlan` YAML, `SidecarSet` YAML, `CloneSet` YAML, `kubectl` commands, or a short ordered procedure. |
| 24 | - Verify the extension name and exact version before generating a final `InstallPlan`. |
| 25 | - Default the extension name to `openkruise` only if the user context or cluster output does not expose a different resource name. |
| 26 | - In this KubeSphere environment, the observed mapping is: |
| 27 | - KubeSphere extension version `1.0.3` |
| 28 | - OpenKruise runtime version `1.4.0` |
| 29 | - Distinguish two version concepts before generating `InstallPlan`: |
| 30 | - KubeSphere extension version: used by `spec.extension.version` |
| 31 | - OpenKruise runtime version: the controller or component version seen in Pods or docs |
| 32 | - For this environment, if the user asks to install the current OpenKruise plugin and does not provide another extension version, prefer `spec.extension.version: 1.0.3`. |
| 33 | - If the user only provides the OpenKruise runtime version, first ask them to confirm the matching KubeSphere extension version. |
| 34 | - Never invent a version. If the version is missing, first show how to list versions and ask the user to confirm one. |
| 35 | - `InstallPlan.metadata.name` MUST equal `InstallPlan.spec.extension.name`. |
| 36 | - `InstallPlan` is cluster-scoped in KubeSphere. Do not add a namespace to `kubectl get|describe|delete installplan`. |
| 37 | - Use `upgradeStrategy: Manual` unless the user explicitly asks for something else. |
| 38 | - Omit optional fields instead of guessing values. |
| 39 | - Before generating `SidecarSet` or `CloneSet`, prefer checking the installed API versions: |
| 40 | |
| 41 | ```bash |
| 42 | kubectl api-resources --api-group apps.kruise.io |
| 43 | ``` |
| 44 | |
| 45 | - If the cluster version is unknown and the user only wants an example, prefer: |
| 46 | - `SidecarSet`: `apps.kruise.io/v1alpha1` |
| 47 | - `CloneSet`: `apps.kruise.io/v1alpha1` |
| 48 | - For uninstall requests, warn that deleting CRDs or CR instances can remove application configuration. Do not suggest deleting CRDs unless the user explicitly asks for full cleanup. |
| 49 | |
| 50 | ## Version Mapping Discovery |
| 51 | |
| 52 | Treat the `1.0.3 -> 1.4.0` mapping as environment evidence, not a universal rule. When the user asks for precision, prove it first: |
| 53 | |
| 54 | ```bash |
| 55 | # Discover KubeSphere extension version |
| 56 | kubectl get extensionversions.kubesphere.io -l kubesphere.io/extension-ref=openkruise |
| 57 | kubectl get extensionversion openkruise-1.0.3 -o yaml |
| 58 | |
| 59 | # Discover deployed runtime image or controller version |
| 60 | kubectl get pods -n kruise-system -o wide |
| 61 | kubectl get deploy -n kruise-system kruise-manager -o jsonpath='{.spec.template.spec.containers[*].image}' |
| 62 | kubectl describe pod -n kruise-system <kruise-manager-pod> |
| 63 | ``` |
| 64 | |
| 65 | If these commands disagree with the assumed mapping, prefer cluster output over the baked-in default. |
| 66 | |
| 67 | ## Discovery Commands |
| 68 | |
| 69 | This section provides two approaches for querying OpenKruise status: |
| 70 | 1. **KubeSphere API (curl)** - for extension management and multi-cluster queries |
| 71 | 2. **kubectl** - for direct Kubernetes resource operations |
| 72 | |
| 73 | ### Option 1: Using KubeSphere API (curl) |
| 74 | |
| 75 | Use curl with environment variables for querying KubeSphere extension status and multi-cluster resources. |
| 76 | |
| 77 | **Environment Variables:** |
| 78 | ```bash |
| 79 | export KS_HOST="http://<kubesphere-host>" # KubeSphere console URL (required) |
| 80 | export KS_USERNAME="admin" # Username (default: admin) |
| 81 | export KS_PASSWORD="<password>" # Password (required) |
| 82 | ``` |
| 83 | |
| 84 | **Helper Functions (add to ~/.bashrc or use directly):** |
| 85 | ```bash |
| 86 | # Get OAuth token |
| 87 | ks_token() { |
| 88 | curl -s -X POST "$KS_HOST/oauth/token" \ |
| 89 | -H "Content-Type: application/x-www-form-urlencoded" \ |
| 90 | -d "grant_type=password&username=${KS_USERNAME:-admin}&password=$KS_PASSWORD&client_id=kube |