Логотип Huawei Cloud Cce Chaos Experiment

Huawei Cloud Cce Chaos Experiment

Организация
huaweicloud
huawei-cloud-cce-chaos-experiment

Huawei Cloud CCE AZ power outage chaos experiment — end-to-end fault drill: discover clusters and node AZ distribution, validate cross-AZ capacity, shut down all CCE nodes in one AZ to simulate a power failure, observe Pod eviction and rescheduling to surviving AZs, then start nodes back and verify recovery, and optionally analyze logs for an impact report. Use this skill when the user wants to run or prepare a CCE fault drill / chaos experiment / AZ outage drill. Triggers: CCE, 故障演练, 混沌演练, AZ断电, 演练, 故障注入, chaos experiment, AZ power outage, fault drill, chaos drill.

Обзор

Издательhuaweicloud
Репозиторийhuaweicloud-skills
Название навыкаhuawei-cloud-cce-chaos-experiment
Звёзды
59
Форки
24
Файлы в комплекте
24
ЛицензияMIT
Ссылки
  • Инструкции в формате Markdown

    Модель загружает файл SKILL.md по мере необходимости, поэтому токены расходуются только при подходящем запросе.

  • Работает с любой большой языковой моделью

    Навыки ИИ — это обычный Markdown, а не код для конкретного поставщика, поэтому они работают с GPT, Claude, Gemini, Grok и локальными моделями.

  • Файлы в комплекте: 24

    Скрипты, шаблоны и справочные материалы, которые модель может читать во время работы. Файлы доступны только для чтения и никогда не выполняются.

  • Открытый исходный код

    Издатель навыка на GitHub — huaweicloud. Перед установкой изучите исходные материалы.

Установка

Установите навык ИИ Huawei Cloud Cce Chaos Experiment в TypingMind, чтобы использовать его с любой LLM, или добавьте его в другой агент, который умеет читать SKILL.md.

1

Установка в TypingMind

TypingMind устанавливает навык прямо из его папки на GitHub: читает SKILL.md, собирает файлы ресурсов и сохраняет результат локально.

  1. Откройте приложение и перейдите в раздел «Плагины → Навыки».
  2. Выберите «Установить из GitHub».
  3. Вставьте указанную ниже ссылку на папку навыка и подтвердите установку.
    https://github.com/huaweicloud/huaweicloud-skills/tree/master/skills/container/cce/huawei-cloud-cce-chaos-experiment
  4. Включите навык в каждом чате, где хотите его использовать.
Плагины → Навыки → Добавить навык → По ссылке GitHub, затем вставьте ссылку на папку и нажмите «Продолжить».
2

Установка в другом агенте

Любой агент с поддержкой формата Agent Skills может использовать этот навык — скопируйте папку в каталог навыков этого агента.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/huaweicloud/huaweicloud-skills.git /tmp/huaweicloud-skills
mkdir -p .claude/skills
cp -r /tmp/huaweicloud-skills/skills/container/cce/huawei-cloud-cce-chaos-experiment .claude/skills/huawei-cloud-cce-chaos-experiment
После копирования перезапустите Claude Code, чтобы загрузить новый навык.

Использование в TypingMind

Включите навык Huawei Cloud Cce Chaos Experiment в любом чате TypingMind, и дальше модель всё сделает сама. Его название и описание хранятся в системном промпте, а при появлении подходящего запроса модель сама загружает полные инструкции. Вам не нужно вызывать навык вручную, и до фактического использования он не расходует токены.

Модель сама загружает навык Huawei Cloud Cce Chaos Experiment, как только появляется подходящий для него запрос.

Работает с любой моделью ИИ

Навыки ИИ — это обычные инструкции в Markdown, а не код для конкретного поставщика, поэтому навык Huawei Cloud Cce Chaos Experiment не привязан к модели, для которой он был создан. Установите его один раз в TypingMind и используйте с GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama или локальной моделью, которую запускаете самостоятельно, — со своими ключами API.

  • Загружается только при необходимости

    Системный промпт содержит только название и описание. Инструкции загружаются при первом подходящем запросе, поэтому неиспользуемый навык не расходует токены.

  • Меняйте модели прямо в чате

    Навык состоит из инструкций, а не кода, поэтому смена модели не нарушает его работу: новая модель читает тот же файл SKILL.md.

Инструкции навыка

Это содержимое файла SKILL.md, которое загружает модель. Прочитайте его перед установкой: навык — это инструкции, которым будет следовать ваша модель.

Huawei Cloud CCE AZ Power Outage Chaos Experiment

Overview

End-to-end CCE AZ power outage chaos experiment in three phases:

Phase 1: Prepare          Phase 2: Execute           Phase 3: Log Analysis
─────────────             ──────────────             ──────────────────
Discover clusters    →    Pre-check (nodes Ready)  → Load experiment context
Select cluster            Shutdown (BatchStop)       Discover dependencies
Discover node AZs         Monitor (Node/Pod)         Collect logs (LTS + Pod)
Select target AZ          Wait (duration)            Analyze error patterns
Validate compatibility    Rollback (BatchStart)      Generate analysis report
Generate + deploy config  Verify + report

Scenario: Shut down all CCE nodes in one AZ → Kubernetes marks nodes NotReady → Pods evicted and rescheduled to other AZs → start nodes back → verify recovery. Tests cluster HA under AZ-level failure.

Prerequisites

  • hcloud CLI — installed and configured with AK/SK (ECS + CCE permissions)
  • kubectl — installed and configured for CCE cluster access
  • Python 3 — for discovery, validation, execution, and analysis scripts
  • Environment variables: HW_ACCESS_KEY, HW_SECRET_KEY, HW_REGION_NAME (optional, defaults to cn-north-4 if unset)

Run environment check:

bash
bash scripts/check_env.sh

If kubectl is missing, check_env.sh auto-installs it. Manual install:

bash
ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')
curl -fsSL "https://dl.k8s.io/release/v1.28.0/bin/linux/${ARCH}/kubectl" -o /tmp/kubectl_download
sleep 1 && mv /tmp/kubectl_download /usr/local/bin/kubectl && chmod 755 /usr/local/bin/kubectl

Phase 1: Prepare (故障演练准备)

Generates experiment configuration. Does NOT start the experiment.

Step 1.1: Environment Check

bash
bash scripts/check_env.sh

Step 1.2: Determine Region [INTERACTIVE]

Check HW_REGION_NAME environment variable:

  • Set → use that region (confirm with user: "Region is , correct?").
  • Not set → ask the user which region to use. Do NOT silently default to cn-north-4.
bash
echo $HW_REGION_NAME

Region is used in all subsequent --region parameters and hcloud --cli-region calls.

Step 1.3: Discover CCE Clusters

bash
python3 scripts/discover_cce.py --region <region>

Output: JSON with all clusters (ID, name, status, flavor, version).

Step 1.4: User Selects Cluster [INTERACTIVE]

Present discovered clusters in a table. Ask the user to choose — never auto-select.

  • Only Available clusters can be selected directly.
  • Hibernation clusters must be awakened first.

Step 1.5: Get Credentials & Discover Node AZ Distribution

bash
# Obtain kubeconfig
hcloud CCE CreateKubernetesClusterCert --cluster_id=<id> --cli-region=<region> --duration=30 --cli-output=json > /root/.kube/config

# Discover node AZ distribution
KUBECONFIG=/root/.kube/config kubectl get nodes --show-labels

Present node-to-AZ mapping to the user.

Step 1.6: User Selects Target AZ [INTERACTIVE]

Present AZ distribution. Ask the user to choose the target AZ.

  • Show node count per AZ.
  • Warn if cluster has only one AZ (no cross-AZ redundancy).
  • Never auto-select.

Step 1.7: Create Experiment Directory

Create the experiment directory before running discovery and validation, so all artifacts (discovery.json, validation.json, experiment.json, logs, reports) live inside one directory.

bash
EXP_DIR="./experiments/$(date -u +%Y%m%d-%H%M%S)-cce-az-power-$(echo <az> | tr -d '-')"
mkdir -p "$EXP_DIR"
echo "$EXP_DIR"

All subsequent steps use $EXP_DIR as the output path.

Step 1.8: Discover Nodes & Pods in Target AZ

bash
KUBECONFIG=/root/.kube/config python3 scripts/discover_cce.py \
    --region <region> --cluster-id <id> --az <az> \
    --include-pods --output "$EXP_DIR/discovery.json"

Step 1.9: Validate Compatibility [CRITICAL GATE]

bash
KUBECONFIG=/root/.kube/config python3 scripts/validate_targets.py \
    --discovery-file "$EXP_DIR/discovery.json" \
    --cluster-id <id> --az <az> --region <region> \
    --output "$EXP_DIR/validation.json"

Validation rules (see references/cce-validation-rules.md):

  1. All target nodes must be Ready
  2. Cross-AZ capacity sufficient for rescheduling
  3. PDB constraints checked (warnings only for AZ outage — shutdown bypasses eviction API)
  4. Workload replicas ≥ 2 (warning)
  5. Single-AZ cluster risk (error)

Decision: errors → stop and fix. warnings only → proceed to generate.

Step 1.10: Generate, Deploy & Report

bash
# Generate experiment configuration (use --experiment-dir to reuse $EXP_DIR)
python3 scripts/generate_experiment.py \
    --discovery-file "$EXP_DIR/discovery.json" --validation-file "$EXP_DIR/validation.json" \
    --cluster-id <id> --az <az> --region <region> \
    --duration 300 --experiment-dir "$EXP_DIR"

# Deploy experiment (local mode, generates emergency rollback script)
bash scripts/deploy_experiment.sh --experiment-dir "$EXP_DIR/"

Experiment is prepared but NOT started. Proceed to Phase 2 when ready.

Phase 1 References

  • references/cce-az-power-scenario.md — scenario definition, fault impact chain, API mapping
  • references/cce-validation-rules.md — validation rules with rationale and decision matrix
  • references/experiment-template-guide.md — experiment.json schema with full example

Phase 2: Execute (故障演练执行)

Performs actual node shutdown. Target CCE nodes will be stopped.

Step 2.1: Environment Check

bash
bash scripts/check_env.sh

Step 2.2: Execute Experiment [Core Step]

bash
# Normal execution
python3 scripts/execute_experiment.py --experiment-dir "$EXP_DIR/"

# Dry Run (simulate without API calls)
python3 scripts/execute_experiment.py --experiment-dir "$EXP_DIR/" --dry-run

# Auto-rollback on shutdown failure
python3 scripts/execute_experiment.py --experiment-dir "$EXP_DIR/" --auto-rollback

6 Execution Phases

PhaseOperationDescription
1. Pre-checkkubectl get nodesAll target nodes must be Ready
2. Shutdownhcloud ECS BatchStopServersExecute fault injection
3. MonitorPoll Node + Pod statusWait for NotReady + Pod rescheduling
4. Waitsleep(duration)Experiment duration
5. Rollbackhcloud ECS BatchStartServersStart all target nodes
6. VerifyPoll Node + Pod statusConfirm Ready + Running + replicas met

Produces execution-log.json with complete timeline.

Step 2.3: Generate Report

bash
python3 scripts/generate_report.py --log-file "$EXP_DIR/execution-log.json"

Emergency Rollback

bash
python3 scripts/rollback_experiment.py --experiment-dir "$EXP_DIR/"
# Or specify instance IDs directly
python3 scripts/rollback_experiment.py --ids "id1,id2" --region <region>

Phase 2 References

  • references/execution-workflow.md — 6-phase details, execution-log.json format, safety mechanisms
  • references/monitoring-guide.md — Node/Pod state machines, polling mechanism

CCE Resource State Machine

Node:  Ready ──关机──→ NotReady ──开机──→ Ready
Pod:   Running → Terminating → Pending → Running (on new node in other AZ)

Phase 3: Log Analysis (生成日志分析报告)

Collects and analyzes application/CCE logs within the experiment time window.

Step 3.1: Environment Check

bash
bash scripts/check_env.sh

Step 3.2: Load Experiment Context & Analyze Logs

bash
python3 scripts/analyze_logs.py --experiment-dir "$EXP_DIR/" \
    --output-dir "$EXP_DIR/log-analysis"

Auto-detects mode:

  • execution-log.json exists → post-hoc analysis (事后分析)
  • Only experiment.json exists → real-time monitoring (实时监控)

Step 3.3: Discover Affected Services

bash
# Extract affected node names from discovery.json or use known nodes
python3 scripts/discover_dependencies.py \
    --nodes "192.168.0.49,..." \
    --output "$EXP_DIR/log-analysis/dependencies.json"

Scans Service/Ingress/ConfigMap references to identify directly impacted services. Note: discover_dependencies.py queries the cluster directly via kubectl, not from discovery.json. Pass the affected node names with --nodes.

Tip: Step 3.2 (analyze_logs.py) already calls discover_dependencies.py internally, so this step is optional — use it only for standalone dependency discovery.

Step 3.4: Collect Logs

bash
python3 scripts/collect_logs.py --experiment-dir "$EXP_DIR/" \
    --output-dir "$EXP_DIR/log-analysis/collected_logs"

Collects within experiment time window:

  • CCE Pod logs: kubectl logs --since-time
  • LTS logs: hcloud LTS ListLogs
  • Kubernetes Events: kubectl get events

Step 3.5: Generate Analysis Report

bash
python3 scripts/generate_analysis_report.py \
    --analysis "$EXP_DIR/log-analysis/analysis-result.json" \
    --context "$EXP_DIR/log-analysis/dependencies.json" \
    --output "$EXP_DIR/log-analysis/analysis-report.md"

Output: Markdown report with:

  • Experiment overview & affected services
  • Pod rescheduling timeline
  • Error pattern statistics (ERROR/Exception/Connection refused/Timeout/5xx)
  • Business impact assessment
  • Improvement recommendations

Phase 3 References

  • references/analysis-workflow.md — 6-step analysis workflow, error pattern classification table
  • references/managed-service-logs.md — kubectl logs, LTS, CES commands, best practices

Error Pattern Classification

PatternKeywordsSeverityDescription
ERRORerrorHighApplication error
Exceptionexception, stacktraceHighException stack trace
Connection refusedconnection refusedHighService unavailable
Timeouttimeout, deadline exceededMediumTimeout
5xx HTTP500, 502, 503, 504HighServer error
Reconnectreconnect, reconnectedLowReconnected successfully
DegradeddegradMediumDegraded mode
Recoveredrecover, restoredLowRecovered

Script Reference

ScriptPhasePurpose
scripts/check_env.shAllEnvironment verification (shared)
scripts/discover_cce.py1Discover CCE clusters and AZ nodes
scripts/validate_targets.py1Validate cross-AZ capacity and PDB
scripts/generate_experiment.py1Generate experiment config
scripts/deploy_experiment.sh1Deploy experiment (local mode, generate rollback script)
scripts/execute_experiment.py2Main execution (6 phases)
scripts/monitor_resources.py2Monitor Node/Pod status (called by execute)
scripts/rollback_experiment.py2Emergency rollback
scripts/generate_report.py2Generate Markdown execution report
scripts/analyze_logs.py3Main analysis orchestration
scripts/discover_dependencies.py3Discover CCE service dependencies
scripts/collect_logs.py3Collect LTS + CCE Pod logs
scripts/generate_analysis_report.py3Generate Markdown analysis report

Key Design Decisions

  1. Interactive cluster and AZ selection — the agent must present discovered clusters and AZ distributions to the user and let the user choose. Never auto-select.

  2. Validate before generating — cross-AZ capacity and PDB constraints are checked before any files are produced.

  3. PDB warnings are informational for AZ outage — PDBs govern voluntary pod eviction, not direct node shutdown via ECS API. PDB violations are warnings, not errors.

  4. Dry Run and auto-rollback — --dry-run simulates without API calls; --auto-rollback triggers rollback on shutdown failure.

  5. Local deployment mode — deploy_experiment.sh generates the emergency rollback script locally; the full drill flow is executed by the built-in scripts/execute_experiment.py (no external COC dependency).

  6. AZ-scoped targeting — targets all CCE nodes in a specified AZ, simulating real AZ power outage.

  7. Default duration 5 minutes (300s) — sufficient for observing pod rescheduling while limiting blast radius.

  8. Two analysis modes — post-hoc (from execution-log.json) and real-time (from experiment.json during experiment).

  9. All artifacts in one experiment directory — $EXP_DIR is created before discovery; discovery.json, validation.json, experiment.json, execution-log.json, and log-analysis/ all live inside it.

Known Script Issues & Fixes

  1. discover_cce.py — invalid kubeconfig detection: hcloud CCE DownloadClusterConfig returns error with exit code 0 on unsupported versions. Fix: validate config contains "apiVersion" or "clusters"; use CreateKubernetesClusterCert as fallback.

  2. discover_cce.py — get_nodes_by_az return value: Returned [] instead of [], [] on kubectl failure, causing ValueError. Fix: return [], [].

  3. validate_targets.py — CPU millicore parsing: float("1930m") caused ValueError. Fix: parse_cpu() / parse_memory() helpers handle m, Ki, Mi, Gi suffixes.

  4. discover_cce.py — wrong ECS instance ID: Extracted from spec.providerID which contains CCE-internal node ID, not ECS server ID. Fix: get_ecs_instance_map(region) queries hcloud ECS ListServersDetails and builds private-IP → ECS-ID map.

  5. deploy_experiment.sh + execute_experiment.py + rollback_experiment.py — unsupported --body parameter: hcloud KooCLI does not support --body for ECS APIs. Fix: use native parameter format --os-stop.servers.1.id=xxx --os-stop.type=SOFT and --os-start.servers.N.id=xxx.

Limitations

  • Depends on hcloud CLI with ECS and CCE permissions
  • Depends on kubectl with CCE cluster access
  • Cross-AZ capacity check based on node allocatable resources, not real-time usage
  • Pod logs only from currently alive Pods; deleted Pod logs unavailable
  • LTS log queries require LTS agent (ICAgent) installed in CCE cluster
  • Focused on single AZ power outage — does not handle composite scenarios

Файлы в комплекте

Модель читает эти файлы по мере необходимости, пока навык загружен. Они доступны только для чтения и никогда не выполняются.

Часто задаваемые вопросы

Что делает навык ИИ Huawei Cloud Cce Chaos Experiment?

Huawei Cloud CCE AZ power outage chaos experiment — end-to-end fault drill: discover clusters and node AZ distribution, validate cross-AZ capacity, shut down all CCE nodes in one AZ to simulate a power failure, observe Pod eviction and rescheduling to surviving AZs, then start nodes back and verify recovery, and optionally analyze logs for an impact report. Use this skill when the user wants to run or prepare a CCE fault drill / chaos experiment / AZ outage drill. Triggers: CCE, 故障演练, 混沌演练, AZ断电, 演练, 故障注入, chaos experiment, AZ power outage, fault drill, chaos drill.

Зачем использовать Huawei Cloud Cce Chaos Experiment в TypingMind?

Потому что вы устанавливаете навык один раз и используете его с любой моделью. Huawei Cloud Cce Chaos Experiment — это обычный текст в формате Markdown, а не код для конкретного поставщика, поэтому один и тот же навык работает с GPT-5, Claude, Gemini, Grok или локальной моделью. Вы можете менять модель прямо во время чата, и навык продолжит работать. TypingMind использует ваши собственные ключи API, поэтому вы платите поставщикам напрямую, а не оформляете подписку с оплатой за каждое место. Ваши навыки и чаты остаются в вашем собственном хранилище.

Как установить Huawei Cloud Cce Chaos Experiment в TypingMind?

В TypingMind откройте «Плагины → Навыки → Установить из GitHub» и вставьте https://github.com/huaweicloud/huaweicloud-skills/tree/master/skills/container/cce/huawei-cloud-cce-chaos-experiment. TypingMind прочитает файл SKILL.md, включит сопутствующие файлы в пакет и установит навык, который можно включать отдельно для каждого чата.

Какие модели ИИ могут использовать Huawei Cloud Cce Chaos Experiment?

Любая модель, которую вы подключите в TypingMind. Навыки ИИ — это обычные инструкции в формате Markdown, а не код для конкретного поставщика, поэтому GPT, Claude, Gemini, Grok и локальные модели могут загружать этот навык, когда запрос ему соответствует.

Со сколькими моделями ИИ можно использовать Huawei Cloud Cce Chaos Experiment?

С любым количеством. В TypingMind вы можете использовать Huawei Cloud Cce Chaos Experiment с любой моделью, которая поддерживает навыки, в том числе с GPT, Claude, Gemini, Grok, DeepSeek, Mistral и Llama. Для этого вы используете собственные ключи API.

Бесплатен ли навык ИИ Huawei Cloud Cce Chaos Experiment?

Да. Навык опубликован на GitHub по лицензии MIT. Издатель — huaweicloud. Вы платите только своему поставщику ИИ за использованные токены.

Что такое навыки ИИ?

Навык ИИ — это набор инструкций, которыми модель ИИ может пользоваться каждый раз, когда ей нужно выполнить конкретную задачу. Он соответствует открытому формату Agent Skills: файл SKILL.md с названием и описанием, а также любые скрипты, шаблоны или справочные файлы, которые могут понадобиться модели. Модель читает инструкции, только когда ваш запрос соответствует навыку, поэтому установленный навык ничего не стоит, пока не используется.

Чем навыки ИИ отличаются от плагинов и серверов MCP?

Плагин или сервер MCP даёт модели новые инструменты, которые она может вызывать: при вызове где-то выполняется код и возвращает результат. Навык ИИ, напротив, даёт модели знания и описывает порядок действий: как подойти к задаче, какие шаги выполнить и каким должен быть хороший результат. Навыки — это обычный текст в формате Markdown, поэтому им не нужны сервер, ключ API или среда выполнения, и они работают с любой моделью.

Все
Логотип openclaw

Openclaw Testing

openclaw
ОрганизацияПопулярный

Выбирайте подходящие по масштабу тесты и проверки OpenClaw, диагностируйте сбои и направляйте вопросы, зависящие от окружения, и подтверждение релиза ответственным за них специалистам.

82.2K
391K
Файлы: 2
Открыть
Логотип mattpocock

Wizard

mattpocock
СообществоПопулярный

Создаёт интерактивный сценарий на bash, который шаг за шагом проводит человека через действия, доступные только ему. Используйте его для подготовки инфраструктуры, настройки учётных данных или секретов CI, работы с незнакомой…

22.3K
264.4K
Файлы: 2
Открыть
Логотип affaan-m

Deployment Patterns

affaan-m
СообществоПопулярный

Процессы развертывания, паттерны CI/CD-пайплайнов, контейнеризация с Docker, проверки работоспособности, стратегии отката и контрольные списки готовности приложений…

39.1K
261.1K
Инструкции
Открыть
Логотип affaan-m

Docker Patterns

affaan-m
СообществоПопулярный

Паттерны Docker и Docker Compose для локальной разработки: безопасность контейнеров, сетевые настройки, стратегии работы с томами и оркестрация нескольких сервисов.

39.1K
261.1K
Инструкции
Открыть

Создайте своё рабочее пространство с ИИ прямо сейчас

Подпишитесь на нашу рассылку, чтобы узнавать о новых функциях и предстоящих розыгрышах 👇