Google Antigravity を使用した KCC オペレーションの習得

1. はじめに

この Codelab では、IDE をエージェント ファーストの時代へと進化させるエージェント型開発プラットフォームである Google Antigravity(以降、このドキュメントでは Antigravity と表記)について説明します。

行を自動補完するだけの標準的なコーディング アシスタントとは異なり、Antigravity は、計画、コーディング、ウェブの閲覧まで行える自律型エージェントを管理するための「ミッション コントロール」を提供します。

Antigravity はエージェント ファーストのプラットフォームとして設計されています。これは、AI がコードを記述するツールではなく、人間の介入を最小限に抑えながら複雑なエンジニアリング タスクを計画、実行、検証、反復できる自律的なアクターであることを前提としています。

学習内容

  • Antigravity のインストールと構成。
  • Agent Manager、Editor、Browser などの Antigravity の主要なコンセプトについて説明します。
  • Google Cloud リソースを安全性とコンプライアンスで管理するための、本番環境グレードの KCC Ops Skill をゼロから構築します。

必要なもの

現在、Antigravity は個人用の Gmail アカウントのプレビュー版として提供されています。最上位モデルを使用するための無料割り当てが付属しています。

Antigravity はシステムにローカルにインストールする必要があります。このプロダクトは、Mac、Windows、特定の Linux ディストリビューションで利用できます。ご自身のマシンに加えて、次のものが必要です。

  • Gmail アカウント(個人用 Gmail アカウント)。
  • Google Cloud アカウントと Google Cloud プロジェクト
  • Google Cloud コンソールと Cloud Shell をサポートするウェブブラウザ(Chrome など)

2. 設定と要件

プロジェクトのセットアップ

Google Cloud プロジェクトの作成

  1. Google Cloud コンソールのプロジェクト セレクタ ページで、Google Cloud プロジェクトを選択または作成します。
  2. Cloud プロジェクトに対して課金が有効になっていることを確認します。プロジェクトで課金が有効になっているかどうかを確認する方法をご覧ください。

この Codelab は、初心者を含むあらゆるレベルのユーザーとデベロッパーを対象としています。

3. インストール

Antigravity がまだインストールされていない場合は、まず Antigravity をインストールします。現在、このプロダクトはプレビュー版として提供されており、個人の Gmail アカウントを使用して開始できます。

ダウンロード ページに移動し、ケースに該当するオペレーティング システムのバージョンをクリックします。アプリケーション インストーラを起動し、マシンにインストールします。インストールが完了したら、Antigravity アプリケーションを起動します。

セットアップの主な手順:

  • セットアップ フローを選択する: この Codelab では、新規に開始することをおすすめします。
  • レビュー駆動開発(推奨): このオプションを選択します。これにより、エージェントは意思決定を行い、ユーザーに承認を求めることができます。これはインフラストラクチャ オペレーションにとって非常に重要です。

次に、エディタを構成し、Google にログインします。最後に、利用規約に同意します。

4. インフラストラクチャのセットアップ: GKE と Config Connector

スキルを構築する前に、Config Connector(KCC)を手動でインストールし、名前空間モードで構成した Google Cloud 環境が必要です。これにより、GCP リソースを Kubernetes オブジェクトとして管理できます。

ステップ 0: 環境を準備する

1. クラスタの前提条件

必要な機能を有効にして新しい GKE クラスタを作成します。

# Set your variables
export PROJECT_ID=$(gcloud config get-value project)
export CLUSTER_NAME="kcc-ops-cluster"
export REGION="us-central1"

# Create the cluster
gcloud container clusters create ${CLUSTER_NAME} \
    --region ${REGION} \
    --release-channel "regular" \
    --workload-pool=${PROJECT_ID}.svc.id.goog \
    --logging=SYSTEM \
    --monitoring=SYSTEM

# Get cluster credentials
gcloud container clusters get-credentials ${CLUSTER_NAME} --region ${REGION}

2. Config Connector Operator をインストールする

Operator はインストールを最新の状態に保ちます。

# Download the latest Config Connector operator
gcloud storage cp gs://configconnector-operator/latest/release-bundle.tar.gz release-bundle.tar.gz

# Extract the bundle
tar zxvf release-bundle.tar.gz

# Install the operator (Standard Cluster)
kubectl apply -f operator-system/configconnector-operator.yaml

3. Namespace が指定されたモードを構成する

オペレーティング モードを指定する ConfigConnector リソースを作成します。

# configconnector.yaml
apiVersion: core.cnrm.cloud.google.com/v1beta1
kind: ConfigConnector
metadata:
  name: configconnector.core.cnrm.cloud.google.com
spec:
  mode: namespaced
  stateIntoSpec: Absent
kubectl apply -f configconnector.yaml

4. ID と Namespace を作成する

このラボでは、default Namespace と専用の Google サービス アカウント(GSA)を使用します。

# Set your variables
export PROJECT_ID=$(gcloud config get-value project)
export NAMESPACE="default"

# Create the Google Service Account
gcloud iam service-accounts create kcc-identity --project ${PROJECT_ID}

# Grant permissions on the project
gcloud projects add-iam-policy-binding ${PROJECT_ID} \
    --member="serviceAccount:kcc-identity@${PROJECT_ID}.iam.gserviceaccount.com" \
    --role="roles/owner"

# Grant Metric Writer permissions
gcloud projects add-iam-policy-binding ${PROJECT_ID} \
    --member="serviceAccount:kcc-identity@${PROJECT_ID}.iam.gserviceaccount.com" \
    --role="roles/monitoring.metricWriter"

# Bind GSA to KSA via Workload Identity
gcloud iam service-accounts add-iam-policy-binding \
    kcc-identity@${PROJECT_ID}.iam.gserviceaccount.com \
    --member="serviceAccount:${PROJECT_ID}.svc.id.goog[cnrm-system/cnrm-controller-manager-${NAMESPACE}]" \
    --role="roles/iam.workloadIdentityUser"

5. Namespace を構成する

Namespace を監視する ConfigConnectorContext を作成します。

# configconnectorcontext.yaml
apiVersion: core.cnrm.cloud.google.com/v1beta1
kind: ConfigConnectorContext
metadata:
  name: configconnectorcontext.core.cnrm.cloud.google.com
  namespace: default
spec:
  googleServiceAccount: "kcc-identity@${PROJECT_ID}.iam.gserviceaccount.com"
  stateIntoSpec: Absent
kubectl apply -f configconnectorcontext.yaml

6. インストールを確認する

コントローラが default Namespace の準備を完了するまで待ちます。

kubectl wait -n cnrm-system \
    --for=condition=Ready pod \
    -l cnrm.cloud.google.com/component=cnrm-controller-manager \
    -l cnrm.cloud.google.com/scoped-namespace=default

5. エージェント マネージャー: ミッション コントロール

Antigravity はオープンソースの Visual Studio Code(VS Code)の基盤をフォークしますが、ユーザー エクスペリエンスを大幅に変更し、テキスト編集よりもエージェント管理を優先します。インターフェースは、EditorAgent Manager の 2 つの異なるメイン ウィンドウに分かれています。

エージェント マネージャー

通常、Antigravity を起動すると、エージェント マネージャーが表示されます。このインターフェースは、ミッション コントロール ダッシュボードとして機能します。これは高レベルのオーケストレーション用に設計されており、デベロッパーはさまざまなワークスペースやタスクで非同期に動作する複数のエージェントを生成、モニタリング、操作できます。

このビューでは、デベロッパーはアーキテクトとして機能します。大まかな目標を定義します。これらのリクエストごとに、専用のエージェント インスタンスが生成されます。UI には、これらの並列ワークフローの可視化が提供され、各エージェントのステータス、生成されたアーティファクト(プラン、結果、差分)、人間による承認の保留中のリクエストが表示されます。

6. Antigravity Browser と Artifacts

Antigravity は、作業を計画して実行する際にアーティファクトを作成します。これには、リッチ マークダウン ファイル、アーキテクチャ図、画像、ブラウザの録画、コードの差分が含まれます。

アーティファクトは「信頼のギャップ」を解消する

以前は、エージェントが「バグを修正しました」と主張した場合、デベロッパーはコードを読んで確認する必要がありました。Antigravity では、エージェントがそれを証明するアーティファクトを生成します。

アーティファクト

Antigravity によって生成される主なアーティファクトは次のとおりです。

  • Task Lists: コードを記述する前に生成された構造化されたプラン。
  • Implementation Plan: アーキテクチャの変更と技術的な詳細。
  • Walkthrough: 変更の概要とテスト方法。
  • Browser Recordings: UI 検証用のブラウザ セッションの動画記録。

Antigravity ブラウザ

エージェントがウェブを操作する必要がある場合、ブラウザ サブエージェントを呼び出します。このサブエージェントは、コンソールログのクリック、スクロール、入力、読み取りを行うことができます。専用のモデルを使用して、Antigravity が管理するブラウザで開いているページを操作します。

7. エディタの操作

エディタは VS Code の使いやすさを維持しています。標準のファイル エクスプローラ、構文ハイライト表示、拡張機能エコシステムが含まれています。

主なエディタ機能:

  • 予測入力: Tab キーを押して採用されたスマート候補。
  • インポートするタブ: 見つからない依存関係を追加することを提案します。
  • コマンド(Cmd + I: 自然言語を使用してインライン補完をトリガーします。
  • エージェント サイドパネル(Cmd + L: エージェント パネルを切り替えて、@ を使用して質問したり、ファイルを参照したりします。

8. フィードバックの提供

Antigravity の中核となるのは、フィードバックを簡単に収集できる機能です。これらのアーティファクトは、Google ドキュメント スタイルのコメントでエージェントにフィードバックを提供するためのものです。

プランやタスクにコメントを追加する際は、必ずコメントを送信してください。これにより、エージェントを目的の方向に誘導できます。

9. KCC Ops Skill の構築

プラットフォームについて理解できたので、KCC Ops Skill を構築しましょう。

Kubernetes Config Connector(KCC)を使用すると、GCP リソースを K8s オブジェクトとして管理できます。ただし、構成のドリフト、コンプライアンス違反、リソースの誤った再作成を防ぐための安全レールが必要です。

ステップ 1: スキルを構造化する

ワークスペースのルートに、スキルのディレクトリ構造を作成します。

mkdir -p .agents/skills/kcc-ops/scripts
mkdir -p .agents/skills/kcc-ops/resources/policies/templates
mkdir -p .agents/skills/kcc-ops/resources/policies/constraints

ステップ 2: SKILL.md(The Brains)を作成する

SKILL.md は、エージェントのメタデータとコアの「ゴールデン ルール」を定義します。.agents/skills/kcc-ops/SKILL.md を作成します。

---
name: kcc-ops
description: Assists with Config Connector (KCC) configuration, resource generation, and troubleshooting on Google Cloud.
---

# Config Connector (KCC) Operations Skill

Use this skill to manage Google Cloud resources using Kubernetes-style configuration (Config Connector).

## 🛑 GOLDEN RULE: Separate Generation from Application

**NEVER generate and apply a manifest in a single autonomous step.**

1. **Craft:** Write the generated manifest to a local file.
2. **Analyze:** Present the manifest to the user. Perform Impact Analysis and Dry Runs. Explain the consequences of the change (e.g., "If this topic is deleted, the attached subscription becomes orphaned").
3. **Wait:** Pause execution and explicitly wait for user permission to proceed.
4. **Apply:** Only run `kubectl apply` *after* the user has reviewed the manifest and the impact analysis, and then unequivocally confirmed you should proceed.

## Core Responsibilities

0. **Context Verification**: Verify the execution context (cluster, namespace, GCP project, user account) with the user before performing any operations.
1. **Installation & Health**: Verify KCC is properly installed and healthy on the target cluster.
2. **Resource Inventory**: Query and summarize existing KCC resources within a namespace.
3. **Brownfield Bulk Export (Adoption)**: Export existing GCP project resources into valid KCC YAML manifests.
4. **Manifest Generation**: Generate valid YAML manifests for GCP resources using KCC CRDs.
5. **Impact Analysis**: Identify ancillary services and resources (e.g., Cloud Run, Apps) that depend on a resource being modified.
6. **Change Differentiation**: Generate diff summaries for resource edits to support change control.
7. **Policy Compliance**: Vet KCC manifests against OPA/Gatekeeper policies.
8. **Troubleshooting**: Analyze resource status, and consult the troubleshooting guide to resolve reconciliation issues.

## Guidelines for Operations

### 0. Context Verification

Before performing **any operations or executing commands** (including health checks), you **MUST** verify the current execution context and obtain explicit user confirmation.

1. **Read Context:** Use commands like `kubectl config current-context`, `kubectl config view --minify -o jsonpath='{.contexts[0].context.namespace}'`, `gcloud config get-value project`, and `gcloud config get-value account` to determine the active environment.
2. **Present & Ask:** Show this information to the user clearly (e.g., "I see my context is X, namespace is Y, project is Z, and account is A. Is this correct?").
3. **Wait:** Do not proceed with any other steps or scripts until the user has confirmed or provided corrections.

### 1. Installation & Health Check

Before performing operations, ensure the environment is ready:

- **Automation**: You MUST use `./scripts/check-health.sh` to verify namespaces, controllers, and CRDs. Do not use manual kubectl commands for health checks, as the script enforces standard formatting and context verification.

### 2. Resource Inventory & Discovery

To understand the current state of infrastructure:

- **Automation**: You MUST use `./scripts/inventory.sh` to get a summary table of all KCC resources. Do not use manual kubectl queries, as the script is optimized to securely discover all CRDs with context validation.

### 3. Manifest Structure

- All KCC resources belong to the `cnrm.cloud.google.com` API group.
- Use the `cnrm.cloud.google.com/project-id` annotation for cross-project resource management if not using Namespaced Mode.
- Always include `apiVersion`, `kind`, `metadata`, and `spec`.

### 4. Official Resource Reference (Agent Action)

When generating or troubleshooting manifests, you **must not guess** the API schema. Always consult the [Official Config Connector Reference](https://cloud.google.com/config-connector/docs/reference/overview) for the exact API version, kind, and required fields for the specific resource and cross reference with the official [github repository](https://github.com/GoogleCloudPlatform/k8s-config-connector/tree/master/config/crds/resources).

### 5. Troubleshooting Checklist

When a resource is not reconciling (check `kubectl get <kind> <name> -o yaml`):

- **Ready Condition**: Look for `status.conditions` where `type: Ready` and `status: "False"`.
- **Reason/Message**: Check the `reason` and `message` fields in the status conditions.
- **Consult the Guide**: Immediately check `./resources/troubleshooting-guide.md` for definitions of the error reason (e.g. `DependencyInvalid`, `ManagementConflict`) and follow its resolution steps.
- **Common Issues**:
  - Permissions: The KCC service account lacks IAM roles.
  - Quotas: GCP project quota exceeded.
  - Conflicts: Resource already exists or is managed by another tool.
  - Immutable Fields: Attempting to change a field that requires resource recreation. Look for "Update failed" errors related to immutable fields.
  - Reference Resolution: Check if the resource is waiting for a dependency (e.g., `referenced project not found`).

### 6. Impact Analysis (Ancillary Services)

Before modifying a resource (e.g., GCS Bucket, Pub/Sub Topic), verify whatElse depends on it:

- **Reference Search (Cluster-wide)**: Search for other KCC resources that reference the item.

  ```bash
  # Example: Find resources referencing a bucket named 'my-data-bucket'
  kubectl get-all -n <namespace> -o yaml | grep -C 5 "my-data-bucket"
  ```

- **IAM-based Analysis**: Check for IAM Service Accounts that have roles on the specific resource. A Cloud Run job or GKE Workload Identity might be using those permissions.
- **Common Ancillary Dependencies**:
  - **Storage Buckets**: Look for Cloud Run/GKE mounts (CSI), Cloud Functions triggers, or Dataflow jobs.
  - **Networks**: Check for Firewall rules, Forwarding rules, and GKE cluster assignments.
  - **IAM Policies**: Changing a policy might break access for external applications not managed by KCC.
- **Resource Graph**: Use `gcloud asset search-all-resources` to find resources that might have implicit links.

### 3. Policy Compliance & Best Practices

Evaluate KCC manifests against security and governance policies. The vetting tool supports three source modes:

- **Built-in Mode (Default)**: Uses the skill's high-fidelity `v1beta1` library (300+ Anthos constraints).
  - `Usage: ./scripts/vet-policy.sh <manifest-path>`
- **Remote Mode**: Clones and vets against an external Git repository.
  - `Usage: ./scripts/vet-policy.sh <manifest-path> <repo-url> [git-ref]`
  - ⚠️ **Note**: External libraries like the legacy GCP Policy Library may be out-of-date and cause schema validation errors with modern `gator`.
- **Local Mode**: Vets against a local directory of policies.
  - `Usage: ./scripts/vet-policy.sh <manifest-path> /path/to/local/policies`

**Interaction Model:**

1. Call `./scripts/vet-policy.sh` with the appropriate arguments.
2. Interpret the `=== KCC Best Practices ===` and `=== OPA/Gatekeeper ===` reports.
3. Supplement automated findings with manual review for specific security features not yet covered by OPA (e.g., `publicAccessPrevention: enforced`, `versioning: {enabled: true}`).

  ```bash
  # Run the skill's helper script (repo URL and branch are optional)
  ./scripts/vet-policy.sh manifest.yaml [policy-repo-url] [policy-ref]
  ```

## Skill Assets

This skill includes additional resources to streamline operations:

- **`scripts/`**: Automation scripts (e.g., `vet-policy.sh`, `bulk-export.sh`).
- **`examples/`**: Reference KCC manifests (e.g., `restricted-bucket.yaml`).
- **`resources/`**: Common templates, documentation snippets, and troubleshooting guides (e.g., `troubleshooting-guide.md`).

### 4. Safety Rails for Applying Manifests

Before applying any KCC manifest update to an existing resource, you MUST:

- **Verify Immutable Fields**: Call `./scripts/verify-immutable.sh <manifest-path>` to detect updates to fields (like `location`, `name`, `project-id`) that trigger destructive resource recreation.
- **Explain Impact**: If destructive changes are detected, you MUST warn the user and explain the downtime/data loss implications before requesting approval.

### 5. Emergency Recovery & Troubleshooting

If a resource is stuck in a "Deletion" or "Error" state:

- **Check for Abondon Flag**: Check if the resource has the `cnrm.cloud.google.com/deletion-policy: abandon` annotation. If it does, you will need to remove the annotation and then force delete the resource.
- **Force Delete**: Call `./scripts/force-delete.sh <kind> <name> [namespace]` to bypass Kubernetes finalizers and remove the resource from the cluster.
- **Orphan Warning**: Inform the user that force-deleting a KCC object may leave an orphaned resource in Google Cloud that requires manual cleanup.

### 6. Change Differentiation

When editing an existing resource, always generate a diff to summarize the change for reviewers or Git history:

- **Local Diff**:

  ```bash
  # Diff a local file against the cluster state
  kubectl diff -f modified-resource.yaml
  ```

- **Commit Summary Template**:

  ```text
  [KCC Change] Update <ResourceName> (<Kind>)
  - Field 'spec.foo' changed from 'X' to 'Y'
  - Impact: Ancillary service <ServiceName> will see updated <Config>
  ```

### 9. Best Practices

- **Namespaced Mode**: Prefer namespaced mode for better isolation.
- **Sensitive Data**: Use `spec.credential.secretRef` or similar for sensitive fields.
- **Resource Naming**: Use consistent naming conventions that match your Kubernetes/GCP standards.
- **Annotations**:
  - `cnrm.cloud.google.com/deletion-policy: abandon`: Keep GCP resource on KCC deletion.
  - `cnrm.cloud.google.com/state-into-spec: absent`: Prevents KCC from syncing GCP state back into the Kubernetes object (useful for avoiding reconciliation loops on fields like node counts).

## Common Resource Examples

### Compute Instance

```yaml
apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeInstance
metadata:
  name: instance-sample
  annotations:
    cnrm.cloud.google.com/project-id: "my-project-id"
spec:
  machineType: n1-standard-1
  zone: us-central1-a
  bootDisk:
    initializeParams:
      sourceImage: projects/debian-cloud/global/images/family/debian-11
  networkInterface:
    - networkRef:
        name: default
```

### Storage Bucket

```yaml
apiVersion: storage.cnrm.cloud.google.com/v1beta1
kind: StorageBucket
metadata:
  name: bucket-sample
spec:
  location: US
```

### Pub/Sub Topic & Subscription

```yaml
apiVersion: pubsub.cnrm.cloud.google.com/v1beta1
kind: PubSubTopic
metadata:
  name: order-events-topic
---
apiVersion: pubsub.cnrm.cloud.google.com/v1beta1
kind: PubSubSubscription
metadata:
  name: order-processor-sub
spec:
  topicRef:
    name: order-events-topic
  ackDeadlineSeconds: 30
```

ステップ 3: 在庫ツールを実装する

KCC リソースを検出する .agents/skills/kcc-ops/scripts/inventory.sh を作成します。

#!/bin/bash
# List all resources in the cnrm.cloud.google.com group
KCC_KINDS=$(kubectl api-resources --no-headers | awk '/\.cnrm\.cloud\.google\.com/ {print $1}')
KCC_KINDS_CSV=$(echo "$KCC_KINDS" | paste -sd, -)

printf "%-40s %-30s %-10s %s\n" "KIND" "NAME" "READY" "STATUS/MESSAGE"
kubectl get "$KCC_KINDS_CSV" -A -o custom-columns="KIND:.kind,NAME:.metadata.name,READY:.status.conditions[?(@.type=='Ready')].status,MSG:.status.conditions[?(@.type=='Ready')].message" --ignore-not-found --no-headers

ステップ 4: ポリシー審査ロジックを追加する

.agents/skills/kcc-ops/scripts/vet-policy.sh を作成します。このスクリプトは、gator を使用して OPA ポリシーに対してマニフェストを審査します。

#!/bin/bash
MANIFEST=$1
SKILL_ROOT=$(dirname "$(dirname "$0")")
POLICY_SRC="$SKILL_ROOT/resources/policies"

echo "=== OPA/Gatekeeper Policy Vetting ==="
if command -v gator >/dev/null 2>&1; then
    gator test -f "$MANIFEST" -f "$POLICY_SRC/templates" -f "$POLICY_SRC/constraints"
else
    echo "Gator not found. Skipping OPA audit."
fi

ステップ 5: 不変フィールド保護を実装する

これは重要な安全レールです。.agents/skills/kcc-ops/scripts/verify-immutable.sh を作成します。

#!/bin/bash
MANIFEST=$1
KIND=$(grep "^kind:" "$MANIFEST" | awk '{print $2}')
NAME=$(grep "name:" "$MANIFEST" | head -n 1 | awk '{print $2}')

# Check for changes in common immutable fields
IMMUTABLE_FIELDS=("location" "project-id" "name" "zone" "region")
TEMP_FILE=$(mktemp)
kubectl get "$KIND" "$NAME" -o yaml > "$TEMP_FILE" 2>/dev/null

for field in "${IMMUTABLE_FIELDS[@]}"; do
    NEW=$(grep "$field:" "$MANIFEST" | awk '{print $2}')
    OLD=$(grep "$field:" "$TEMP_FILE" | awk '{print $2}')
    if [ -n "$NEW" ] && [ -n "$OLD" ] && [ "$NEW" != "$OLD" ]; then
        echo "🚨 WARNING: Immutable field '$field' is changing! Potential resource recreation."
    fi
done
rm "$TEMP_FILE"

ステップ 6: 緊急復元(強制削除)

.agents/skills/kcc-ops/scripts/force-delete.sh を作成します。

#!/bin/bash
KIND=$1; NAME=$2; NS=${3:-default}
echo "Removing finalizers for $KIND/$NAME in $NS..."
kubectl patch "$KIND" "$NAME" -n "$NS" -p '{"metadata":{"finalizers":null}}' --type=merge
kubectl delete "$KIND" "$NAME" -n "$NS" --wait=false

ステップ 7: リソースを確定する

すべてのスクリプトを実行可能にします。

chmod +x .agents/skills/kcc-ops/scripts/*.sh

10. 新しいスキルをテストする

それでは、新しい会話を開始して、スキルを試してみましょう。

  1. 検出: @kcc-ops Show me all KCC resources in my cluster.
  2. コンプライアンス: StorageBucket を使用してファイル bucket.yaml を作成します。質問: @kcc-ops Vet my bucket.yaml manifest.
  3. 安全性: bucket.yaml の既存のバケットの location を更新しようとします。質問: @kcc-ops Verify my bucket.yaml for immutable changes.

エージェントが適切なスクリプトをインテリジェントに選択し、SKILL.md の「ゴールデン ルール」に沿って対応していることを確認します。

11. エージェントの保護

AI エージェントにターミナルへのアクセス権を付与することは強力ですが、制御が必要です。

[Antigravity - Settings - Terminal] に移動し、[Allow List] と [Deny List] を確認します。

  • 許可リスト: lskubectl get、スキル スクリプトをここに追加します。
  • 拒否リスト: sudorm -rf などの破壊的なコマンドを追加して、エージェントが常に権限を要求するようにします。

12. おわりに

おめでとうございます!Antigravity のインストールから、忠実度の高い KCC オペレーション スキルの構築まで進みました。

学習した内容は以下のとおりです。

  • カスタムの bash ツールを使用してエージェントを拡張する方法。
  • 運用上の「ゴールデン ルール」を SKILL.md にエンコードする方法。
  • 複雑なインフラストラクチャ管理に安全レールを提供する方法。

次のステップ

OPA 制約を追加して resources/policies フォルダを拡張するか、check-health.sh スクリプトを追加してクラスタの準備状況のチェックを自動化します。