AgentSkillsCN

remote-operator-debug

通过远程操作 CLI 调试客户采集器。当您需要查看采集器日志、“客户 kubectl”命令、远程操作工具,或需要在客户的 Kubernetes 集群上执行命令时,可选择此标签。

SKILL.md
--- frontmatter
name: remote-operator-debug
description: Debug customer collectors via remote-operator CLI. Use when "collector logs", "customer kubectl", "remote operator", or need to run commands on customer Kubernetes clusters.

Remote Operator Debug

Run kubectl and other commands on customer collectors via remote-operator.

Prerequisites

  • aws-sso-login skill: AWS authentication
  • remote-operator binary in PATH

Environment URLs

EnvironmentRemote Operator Address
prodhttps://remote-operator-manager.ue1.prod.plat.sm-svc.com
staginghttps://remote-operator-manager.ue1.staging.plat.sm-svc.com

Workflow

Step 1: Get Org ID and Environment

Ask user for:

  • Clerk org ID (e.g., org_345YDItRYVf46uffseTpSKBXNF1)
  • Environment (prod/staging)

Step 2: List Deployments

bash
remote-operator -a <ro_address> -o <org_id> manage ls

Output shows:

  • Deployment names
  • Instance names (needed for commands)
  • Pod status

Step 3: Run Commands

Basic pattern:

bash
remote-operator -a <ro_address> -o <org_id> manage run \
  -d <deployment> --instance-name <instance> \
  -- <command>

Common Commands

Get Logs

bash
# Main collector
remote-operator -a <ro_address> -o <org_id> manage run \
  -d <deployment> --instance-name <instance> \
  -- kubectl logs -n sawmills deployment/sawmills-collector -c main-collector --tail 200

# HAProxy
remote-operator -a <ro_address> -o <org_id> manage run \
  -d <deployment> --instance-name <instance> \
  -- kubectl logs -n sawmills deployment/sawmills-collector -c haproxy --tail 100

# Telemetry collector
remote-operator -a <ro_address> -o <org_id> manage run \
  -d <deployment> --instance-name <instance> \
  -- kubectl logs -n sawmills deployment/sawmills-collector -c telemetry-collector --tail 100

Check Pod Status

bash
remote-operator -a <ro_address> -o <org_id> manage run \
  -d <deployment> --instance-name <instance> \
  -- kubectl get pods -n sawmills

Describe Deployment

bash
remote-operator -a <ro_address> -o <org_id> manage run \
  -d <deployment> --instance-name <instance> \
  -- kubectl describe deployment sawmills-collector -n sawmills

Get Helm Values

bash
remote-operator -a <ro_address> -o <org_id> manage run \
  -d <deployment> --instance-name <instance> \
  -- helm get values sawmills-collector -n sawmills

Restart Pods

bash
remote-operator -a <ro_address> -o <org_id> manage run \
  -d <deployment> --instance-name <instance> \
  -- kubectl rollout restart deployment/sawmills-collector -n sawmills

Check Events

bash
remote-operator -a <ro_address> -o <org_id> manage run \
  -d <deployment> --instance-name <instance> \
  -- kubectl get events -n sawmills --sort-by='.lastTimestamp'

Filtering Logs

bash
# Grep for errors
remote-operator ... -- kubectl logs ... | grep -i error

# Filter by time (last 5 minutes)
remote-operator ... -- kubectl logs ... --since=5m

# Follow logs (streaming)
remote-operator ... -- kubectl logs ... -f

Namespace

Default namespace is sawmills. Service account has limited permissions:

  • Can access sawmills namespace
  • Cannot list pods across all namespaces (-A flag fails)

Troubleshooting

IssueSolution
executable file not foundCommand not available in container
ForbiddenService account lacks permission
No resources foundWrong namespace or no matching pods
timeoutNetwork issues or large output

Example Session

bash
# 1. Set variables
ORG=org_345YDItRYVf46uffseTpSKBXNF1
RO=https://remote-operator-manager.ue1.prod.plat.sm-svc.com

# 2. List deployments
remote-operator -a $RO -o $ORG manage ls

# 3. Get logs from specific instance
remote-operator -a $RO -o $ORG manage run \
  -d SawmillsPoc --instance-name 7fc25w8 \
  -- kubectl logs -n sawmills deployment/sawmills-collector -c main-collector --tail 100

Notes

  • Instance name changes on redeployment; re-run manage ls to get current
  • Large log output may be truncated; use --tail to limit
  • Some commands like logs may default to wrong container; specify -c