AGENT SKILL

manage-cluster

Bring an existing GKE cluster under management on user request (e.g. "manage my cluster <name> in <location>") by creating its Cluster Agent profile, or take one out of management by excluding it. Use whenever a user asks to manage/onboard/watch a specific existing cluster, or to stop managing, exclude or offboard one.

License 许可
Apache-2.0
最近更新
2026-11-14
Stars
★ 126
Forks
44

01 前言 Front Matter

name
manage-cluster
description
Bring an existing GKE cluster under management on user request (e.g. "manage my cluster <name> in <location>") by creating its Cluster Agent profile, or take one out of management by excluding it. Use whenever a user asks to manage/onboard/watch a specific existing cluster, or to stop managing, exclude or offboard one.

03 SKILL.md 正文

Manage Cluster Skill

When a user asks you to manage (onboard / start watching) a specific existing GKE cluster — e.g. "manage my cluster payments-prod in us-central1" — bring it under management by creating its Cluster Agent profile. After this, the cluster gets a per-cluster agent and is delegable via the kanban board.

This is the explicit, user-driven counterpart to onboarding-time creation (gke-cluster-creation). It is safe to run repeatedly (idempotent).

Steps

  1. Gather the target. You need project, cluster, and location.

    • Use any values the user gave. If the user omits the project, resolve it:
      • default to the platform's active project: gcloud config get-value project; then
      • confirm the cluster exists in that project (next step). If it isn't there, or the name is ambiguous, run gcloud container clusters list --format="value(name,location,resourceLabels)" (optionally --project <p>) to locate it, and ask the user only if still ambiguous.
  2. Verify the cluster exists before creating a profile (clean error instead of a half-scaffold):

    • verify_gke_cluster (platform GKE tool) or gcloud container clusters describe <cluster> --location <location> --project <project> --format="value(status)".
    • If it does not exist, tell the user and stop.
  3. Create the profile:

    python3 /opt/data/scripts/cluster_agent_profile.py create \
      --project "<project>" --cluster "<cluster>" --location "<location>"
    

    This scaffolds the Cluster Agent profile home on the data PVC, pins a read-only KUBECONFIG to that cluster, stamps its cluster_identity into the profile config and ## Target Cluster Identity into SOUL.md, and prints the profile name. It is idempotent — re-managing an already-managed cluster is a safe no-op.

  4. Confirm to the user. Report that <cluster> (<project>/<location>) is now managed: it has a Cluster Agent and is delegable (kanban).

This step gives the cluster an agent immediately. Even without it, the cluster-agent-reconcile cron automatically gives every cluster in every project in scope — including the management cluster where kube-agents runs — an agent on its next run; this skill just does it now.

Stop managing

Because reconciliation manages all clusters in every project in scope, deleting a still-existing cluster's profile alone won't stick — the next reconcile recreates it. To stop managing a cluster:

  • Tear down the cluster (see gke-cluster-creation); reconcile prunes its profile automatically.
  • Or exclude it: declare the cluster as an exclusion where the install's scope is declared, which depends on how the PlatformAgent is applied. Take that from the request, or ask; the agent cannot read the Helm release record. On an install made with install.sh and upgraded with upgrade.sh (an install.env exists; the Terraform composition applies the chart from it), have the user add project/location/cluster to SCOPE_EXCLUDE_CLUSTERS in install.env and run ./upgrade.sh --upgrade-mode=full, which renders the exclusion into spec.scope.exclude.clusters and the reconcile prunes the profile on its next run. Do not route them to edit the PlatformAgent or the chart values by hand there. A CR edit takes effect at the next reconcile, but the next full upgrade refuses to apply over a spec.scope that install.env does not record, and prints the SCOPE_* lines that would; a helm upgrade by hand is not refused, the next full upgrade renders install.env's scope over it and the profile comes back. On a chart installed with helm install directly, the exclusion is the value platformAgent.scope.exclude.clusters and a helm upgrade; on the composition applied directly, scope.exclude.clusters in its tfvars. On a hand-applied PlatformAgent (no meta.helm.sh/release-name annotation: kubectl get platformagent -n kubeagents-system -o jsonpath='{.items[0].metadata.annotations.meta\.helm\.sh/release-name}', the install's namespace), add an entry {projectId, location, clusterName} to spec.scope.exclude.clusters on it (the operator delivers it to the reconcile, which prunes the profile on its next run). Fleet answers and the per-cluster audits leave an excluded cluster out too, not only the profile. The older RECONCILE_EXCLUDE bare-name variable on the cluster-agent-reconcile cron still works for one release.

Notes

  • Requires the cluster to be reachable by the platform's credentials (the create step runs gcloud container clusters get-credentials). If that fails, surface the error — the user may need to grant access.
  • The Cluster Agent is read-only; managing a cluster does not grant any mutation ability. Remediation still flows through the Platform Agent's GitOps write path.

04 同仓库更多 Skills

gke-labs
gke-labs/kube-agents

gke-workload-troubleshooting

Diagnoses GKE workload failures (CrashLoopBackOff, OOMKilled, ImagePullBackOff, Pending, etc.) via logs and events. Use when pods fail to start or crash repeatedly. Don't use for GKE cluster infrastructure provisioning, node pool creation, or non-Kubernetes Google Cloud services.

★ 126
gke-labs
gke-labs/kube-agents

gke-workload-security

Audits, configures, and hardens workload-level security controls for Google Kubernetes Engine (GKE) applications and namespaces. Covers running security audits (`audit_cluster.sh`), enforcing Network Policies (default-deny and Dataplane V2 logging), isolating high-risk pods inside GKE Sandbox (`gVisor`), enforcing Pod Security Standards (`restricted` labeling) and pod securityContext, and mounting Secret Manager secrets via CSI (`SecretProviderClass`). Use when auditing workload security posture, isolating namespaces, applying pod security standards, or configuring network policies and secret volume mounts. Don't use for Workload Identity (use gke-workload-identity), cluster-wide control plane security, RBAC hardening, Binary Authorization, Shielded Nodes, or enabling platform-level GKE add-ons (use gke-platform-security instead).

★ 126
gke-labs
gke-labs/kube-agents

gke-workload-scaling

Manages scaling for GKE workloads using HPA and VPA. Use when configuring Horizontal Pod Autoscaler (HPA), configuring Vertical Pod Autoscaler (VPA), or applying best practices for GKE workload autoscaling. Do not use for cluster-level autoscaling (Cluster Autoscaler), static cluster sizing, or configuring node-level machine styles directly.

★ 126
gke-labs
gke-labs/kube-agents

gke-workload-identity

Configures and diagnoses Workload Identity Federation for GKE authentication failures for Pods (403 "iam.serviceAccounts.getAccessToken" / permission denied, "could not find default credentials", or GKE metadata server unreachable) by verifying cluster and node-pool Workload Identity configuration, the Kubernetes ServiceAccount (KSA) to IAM binding (direct principal binding and legacy Google ServiceAccount impersonation), target-resource IAM roles, and gke-metadata-server health. Use when setting up KSA/GSA bindings (`roles/iam.workloadIdentityUser`, `iam.gke.io/gcp-service-account`) or when a Pod cannot authenticate to Google Cloud APIs. Don't use for in-cluster Kubernetes RBAC errors (API-server authorization), general workload crashes (use gke-workload-troubleshooting), or Pod Security Standards and NetworkPolicies (use gke-workload-security).

★ 126
gke-labs
gke-labs/kube-agents

gke-upgrades

Plans, executes, and validates Google Kubernetes Engine (GKE) cluster upgrades and maintenance operations for both Standard and Autopilot clusters. Produces upgrade plans, pre/post-upgrade checklists, maintenance runbooks with gcloud commands, release channel strategy, and troubleshooting guides. Handles node pool upgrade strategies (surge, blue-green), version compatibility, PDB management, and workload-specific concerns (stateful, GPU, operators). Use this skill whenever the user mentions GKE upgrades, Kubernetes version bumps, node pool maintenance, GKE patching, cluster version management, release channel selection, maintenance windows, surge upgrades, stuck upgrades, or any GKE lifecycle management task — even casual mentions like "we need to upgrade our clusters" or "plan our next GKE maintenance" or "our upgrade is stuck." Don't use for GKE cluster creation, application onboarding, general networking/routing setup, or security policy configurations (use gke-basics or relevant GKE skills instead).

★ 126
gke-labs
gke-labs/kube-agents

gke-tpu-metrics-monitoring

Monitors and troubleshoots GKE TPU workloads, nodes, and node pools using GKE system metrics and PromQL. Use when monitoring TensorCore duty cycle, TPU memory, node readiness, multi-host TPU node pool availability, host maintenance or preemption interruptions, and calculating MTTR or MTBI metrics for GKE TPUs. Don't use for general non-TPU GKE workload monitoring or non-metric TPU debugging.

★ 126