This repository contains useful scripts and tools to support availability testing in Kubernetes environments, including analyzing pod terminations, creating Grafana annotations, and merging termination events with performance metrics.
Creates Grafana annotations for each pod termination event from a CSV file. This allows you to visualize pod terminations directly on your Grafana dashboards.
Usage:
node scripts/create-grafana-annotations.js <path-to-csv>Example:
node scripts/create-grafana-annotations.js ./reports/istio-run1/pod-terminations.csvInput CSV Format: The CSV file should contain at minimum:
Pod: Pod nameTermination Time: Unix timestamp in milliseconds
Features:
- Parses CSV files with pod termination data
- Creates timestamped annotations in Grafana via API
- Includes rate limiting (100ms delay between requests)
- Provides summary with success/failure counts
Environment Variables:
GRAFANA_URL: Your Grafana instance URLGRAFANA_TOKEN: API token with annotation write permissionsPREFIX: Custom prefix for annotation text (optional, default: "Pod")
Create a .env file in the project root with the above variables.
Merges pod termination events with k6 performance metrics into a single CSV file for unified analysis and visualization.
Usage:
node scripts/merge-terminations.js <path-to-report-folder>Example:
node scripts/merge-terminations.js ./reports/istio-run1Required Input Files: The specified folder must contain:
pod-terminations.csv: Pod termination events with timestamp and pod namek6-time-series.csv: k6 performance metrics time series data
Output:
merged-time-series.csv: Combined CSV with all metrics and a new "Pod Termination" column- Entries are sorted chronologically by timestamp
- Termination events appear as rows with only timestamp and pod termination info
- Metric rows retain all original k6 data with empty pod termination field
Features:
- Handles both Unix timestamps (seconds/milliseconds) and ISO date formats
- Preserves all original metric columns
- Adds "Pod Termination" column to indicate termination events
- Sorts all data chronologically
- Displays sample merged data in console output
Kubernetes manifests for simulating pod failures in various namespaces. These tools help test high availability and resilience by randomly terminating pods during test runs.
Available Configurations:
- k8s-pod-killer-istio.yaml - Terminates Istio ingress gateway and ztunnel pods
- k8s-pod-killer-ml-core.yaml - Terminates ML core service pods
- k8s-pod-killer-redis-kafka.yaml - Terminates Redis and Kafka pods
- k8s-pod-killer-security.yaml - Terminates security service pods
How it works:
- Deploys a Kubernetes Job/Pod with RBAC permissions to delete pods
- Randomly selects one pod per configured pattern in target namespaces
- Deletes pods with configurable sleep intervals between terminations
- Outputs CSV report with pod names, termination timestamps, and status
Configuration: Each manifest can be customized via environment variables:
SLEEP_SECONDS: Interval between pod deletions (default: 120-180s depending on manifest)DRY_RUN: Set totrueto simulate without actually deleting pods- Namespace and pod name patterns can be adjusted per use case
Usage:
# Deploy the pod killer (example for Istio)
kubectl apply -f pod-killer/k8s-pod-killer-istio.yaml
# Monitor the pod killer logs
kubectl logs -n istio-system pod-killer-istio -f
# View the termination report in the logs (CSV format at the end)Output: The pod killer generates a CSV report in the logs with columns:
Pod: Name of the terminated podTermination time: Unix timestamp in millisecondsStatus: DELETED, DRY_RUN, or DELETE_ERROR
This CSV output can be saved to pod-terminations.csv for use with the analysis scripts.
- Run your HA tests and collect pod termination data and k6 metrics
- Merge the data for local analysis:
node scripts/merge-terminations.js ./reports/your-test-run
- Create Grafana annotations for visualization:
node scripts/create-grafana-annotations.js ./reports/your-test-run/pod-terminations.csv
- Produce the files as evidence of your availability testing.
Pod,Termination Time
service-pod-abc123,1704067200000
api-pod-def456,1704067260000Time,Success Rate,Error Rate,Response Time p95
1704067200000,99.5,0.5,123.45
1704067260000,97.2,2.8,456.78Time,Success Rate,Error Rate,Response Time p95,Pod Termination
1704067200000,99.5,0.5,123.45,
1704067200000,,,,service-pod-abc123 killed
1704067260000,97.2,2.8,456.78,
1704067260000,,,,api-pod-def456 killed