{"id":28394628,"url":"https://github.com/tkestack/tke-chaos-playbook","last_synced_at":"2025-06-27T00:31:26.431Z","repository":{"id":295926139,"uuid":"991692787","full_name":"tkestack/tke-chaos-playbook","owner":"tkestack","description":"A Kubernetes fault simulation solution to help you minimize blast radius","archived":false,"fork":false,"pushed_at":"2025-06-03T09:03:32.000Z","size":642,"stargazers_count":11,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-07T18:49:52.918Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tkestack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-28T02:41:00.000Z","updated_at":"2025-06-03T09:03:34.000Z","dependencies_parsed_at":"2025-05-28T04:44:33.102Z","dependency_job_id":"4192797d-2c46-4cc1-8197-ce8224b6c47d","html_url":"https://github.com/tkestack/tke-chaos-playbook","commit_stats":null,"previous_names":["tkestack/tke-chaos-playbook"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tkestack/tke-chaos-playbook","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkestack%2Ftke-chaos-playbook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkestack%2Ftke-chaos-playbook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkestack%2Ftke-chaos-playbook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkestack%2Ftke-chaos-playbook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tkestack","download_url":"https://codeload.github.com/tkestack/tke-chaos-playbook/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkestack%2Ftke-chaos-playbook/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262166145,"owners_count":23268990,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-31T18:37:56.724Z","updated_at":"2025-06-27T00:31:26.423Z","avatar_url":"https://github.com/tkestack.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kubernetes Chaos Testing Playbooks Guide\n\n[English](README.md) | [中文](README_zh.md)\n\n## Background\n\nKubernetes' centralized architecture and declarative management model, while enabling efficient operations, also introduce critical risks of cascading failures. The open ecosystem (with third-party components like Flink and Rancher) and complex multi-service environments further exacerbate these risks:\n\n- Cascading deletion disaster: A customer using Rancher to manage Kubernetes clusters accidentally deleted a namespace, which subsequently deleted all core business workloads and Pods in the production cluster, causing service interruption.\n- Control plane overload: In a large OpenAI cluster, deploying a DaemonSet monitoring component triggered control plane failures and coredns overload. The coredns scaling depended on control plane recovery, affecting the data plane and causing global OpenAI service disruption.\n- Data plane's strong dependency on control plane: In open-source Flink on Kubernetes scenarios, kube-apiserver disruption may cause Flink task checkpoint failures and leader election anomalies. In severe cases, it may trigger abnormal exits of all existing task Pods, leading to complete data plane collapse and major incidents.\n\nThese cases are not uncommon. The root cause lies in Kubernetes' architecture vulnerability chain - a single component failure or incorrect command can trigger global failures through centralized pathways. \n\nTo proactively understand the impact duration and severity of control plane failures on services, we should conduct regular fault simulation and assessments to improve failure response capabilities, ensuring Kubernetes environment stability and reliability. \n\nThis project provides Kubernetes chaos testing capabilities covering scenarios like node shutdown, accidental resource deletion, and control plane component (etcd, kube-apiserver, coredns, etc.) overload/disruption, it will help you minimize blast radius of cluster failures.\n\n## Prerequisites\n\n1. Prepare two Kubernetes clusters: `src cluster` (for executing testing workflows) and `dest cluster` (the target cluster for testings).\n\n**dest cluster**\n\n2. Create `tke-chaos-test/tke-chaos-precheck-resource ConfigMap` in `dest cluster` as a marker for testing eligibility:\n```bash\nkubectl create ns tke-chaos-test \u0026\u0026 kubectl create -n tke-chaos-test configmap tke-chaos-precheck-resource --from-literal=empty=\"\"\n```\n\n**src cluster**\n\n3. Obtain `dest cluster`'s internal kubeconfig from Tencent Cloud TKE Console, save to `dest-cluster-kubeconfig` file, then create secret in `src cluster`:\n```bash\nkubectl create ns tke-chaos-test \u0026\u0026 kubectl create -n tke-chaos-test secret generic dest-cluster-kubeconfig --from-file=config=./dest-cluster-kubeconfig\n```\n\n4. Clone this project and then deploy Argo Workflow in `src cluster` (skip if Argo is already deployed, [**Argo Documentation**](https://argo-workflows.readthedocs.io/en/latest/)):\n```bash\n# Clone this project\ngit clone https://github.com/tkestack/tke-chaos-playbook.git \u0026\u0026 cd tke-chaos-playbook\n\n# Deploy Argo Workflow\nkubectl create -f playbook/install-argo.yaml\n\n# Verify Argo Workflow Pod status\nkubectl get po -n tke-chaos-test\n```\n\n5. Enable public access for `tke-chaos-test/tke-chaos-argo-workflows-server Service` in Tencent Cloud TKE Console. Access Argo Server UI at `LoadBalancer IP:2746` using credentials obtained via:\n\nNote: If the cluster restricts public access, please configure the Service for internal access and connect via internal network.\n\n```bash\n# Get Argo Server UI access token\nkubectl exec -it -n tke-chaos-test deployment/tke-chaos-argo-workflows-server -- argo auth token\n```\n\n![Argo Server UI](./playbook/docs/argo-server-ui.png)\n\n## Quick Start\n\nThe Kubernetes Control Plane fault simulation Playbook is an automated pipeline built on Argo Workflow.\n\nUsing `kube-apiserver overload` as an example:\n\n- Create kube-apiserver overload workflow:\n```bash\nkubectl create -f playbook/rbac.yaml \u0026\u0026 kubectl create -f playbook/all-in-one-template.yaml\nkubectl create -f playbook/workflow/apiserver-overload-scenario.yaml\n```\n\n![apiserver overload flowchart](./playbook/docs/chaos-flowchart-en.png)\n\n**Core Workflow Explanation**\n\n- **Testing Configuration**: Before execution, you may need to configure parameters like `webhook-url` for notifications. Default values are provided so testings can run without modification. See [Scenario Parameters](playbook/README.md) for details.\n- **Precheck**: Before execution, `dest cluster` health is validated by checking Node and Pod health ratios. Testings are blocked if below thresholds (adjustable via `precheck-pods-health-ratio` and `precheck-nodes-health-ratio`). Also verifies existence of `tke-chaos-test/tke-chaos-precheck-resource ConfigMap`.\n- **Execute Testing**: During kube-apiserver overload testing, the system floods `dest cluster`'s kube-apiserver with List Pod requests to simulate high load. Monitor kube-apiserver metrics via Tencent Cloud TKE Console and observe your business Pod health during testing.\n- **Result Processing**: View testing results in Argo Server UI (recommended) or via `kubectl describe workflow {workflow-name}`.\n\n### Deleting Tests\n```bash\nkubectl delete -f playbook/workflow/apiserver-overload-scenario.yaml\n```\n\n## Roadmap\n\n| Supported Features                         | Priority | Status      | Planned Release | Description                                                     |\n|--------------------------------------------|----------|-------------|-----------------|-----------------------------------------------------------------|\n| apiserver overload                         |   -      | Completed   |      -          | Simulate kube-apiserver high load                               |\n| etcd overload                              |   -      | Completed   |      -          | Simulate etcd high load                                         |\n| apiserver overload (APF)                   |   -      | Completed   |      -          | Add Expensive List APF Policy,Simulate kube-apiserver high load |\n| etcd overload (ReadCache/Consistent cache) |   -      | Completed   |      -          | Add Etcd Overload Protect Policy, Simulate etcd high load       |\n| coredns disruption                         |   -      | Completed   |      -          | Simulate coredns service disruption                                 |\n| kubernetes-proxy disruption                |   -      | Completed   |      -          | Simulate kubernetes-proxy disruption                                |\n| accidental deletion scenario               |   -      | Completed   |      -          | Simulate accidental resource deletion                           |\n| TKE managed cluster kube-apiserver disruption     |   -      | Completed   |      -          | Simulate kube-apiserver disruption                                  |\n| TKE managed cluster kube-scheduler disruption      | -       | Completed   |      -          | Test scheduling behavior during scheduler failure               |\n| TKE managed cluster kube-controller-manager disruption     | -       | Completed   |      -          | Validate controller component failure scenarios                 |\n| TKE Self-Maintenance Cluster master node shutdown  | P1       | In Progress |  2025-06-30     | Simulate master node poweroff                                   |\n| etcd disruption                                | P1       | In Progress |  2025-06-30     | Simulate etcd cluster failure                                   |\n\n## FAQ\n1. Why use two clusters for fault simulation?\n\n  Testings are orchestrated using Argo Workflow, which follows a CRD-based pattern heavily dependent on kube-apiserver. Using a single cluster for fault simulation (especially apiserver/etcd overload or disruption tests) would make kube-apiserver unavailable, preventing Argo Workflow Controller from functioning and halting the entire workflow.\n\n2. How to track testing progress after starting?\n\n  Monitor testing progress via Argo Server UI or `kubectl get -n tke-chaos-test workflow`. By default, testings run in the `tke-chaos-test` namespace. You can also watch fault simulation Pods via `kubectl get -n tke-chaos-test po -w` - Error-state Pods typically indicate testing failures that can be investigated via Pod logs.\n\n3. What are common failure reasons?\n\n  Typical issues include: insufficient RBAC permissions for fault simulation Pods, missing `tke-chaos-test/tke-chaos-precheck-resource ConfigMap` in target cluster, missing `tke-chaos-test namespace`, or Argo workflow controller anomalies. Check fault simulation Pod or Argo Workflow Controller logs for details.\n\n4. How to troubleshoot Argo Workflow Controller issues?\n\n  When workflows show no status after creation via `kubectl get workflow`, the Argo workflow-controller is likely malfunctioning. Check controller logs via:\n```bash\nkubectl logs -n tke-chaos-test deployment/tke-chaos-argo-workflows-workflow-controller --tail 50 -f\n```\n  Many cases involve insufficient RBAC permissions - modify the corresponding ClusterRole to add required permissions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkestack%2Ftke-chaos-playbook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftkestack%2Ftke-chaos-playbook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkestack%2Ftke-chaos-playbook/lists"}