mysql-skill
SKILL.md
MySQL Skill
This skill provides a standardized framework for MySQL lifecycle management: deployment, monitoring, benchmarking, and visualization.
Mandatory Configuration
- StatefulSet Name:
mysql(Pods:mysql-0) - Service Name:
mysql-headless - Secret Name:
mysql-secret - Network:
hostNetwork: true - Replicas: 1
- Health Checks: Mandatory
livenessProbeandreadinessProbe. - Resources: Explicit
requestsandlimitsfor CPU/Memory. - Grace Period:
terminationGracePeriodSeconds: 30.
Visualization Standards (Graphviz/dot)
When generating diagrams, use the following standardized Graphviz template to ensure consistency and high contrast.
Design Principles:
- Progressive Disclosure: Group components into clusters. Highlight Probes and Resources in the detailed view.
- Visual Style: Pastel/Light palette, dark borders (#333333), Arial/Helvetica font.
- Command: Convert to JPG using:
dot -Tjpg input.dot -o output.jpg
Standard DOT Template:
digraph G {
fontname="Helvetica,Arial,sans-serif";
node [fontname="Helvetica,Arial,sans-serif", style=filled, shape=rect, penwidth=2];
edge [fontname="Helvetica,Arial,sans-serif", color="#666666"];
rankdir=LR;
bgcolor="#ffffff";
subgraph cluster_0 {
label = "Kubernetes Cluster";
style=dashed; color="#999999";
subgraph cluster_pod {
label = "MySQL Pod (mysql-0)";
style=filled; color="#e3f2fd"; fillcolor="#f1f8ff";
mysql [label="MySQL Container\n(3306)\n[Probes: .my.cnf]\n[Limits: 500m/1Gi]", fillcolor="#bbdefb"];
exporter [label="MySQL Exporter\n(9104)\n[Limits: 100m/256Mi]", fillcolor="#c8e6c9"];
secret [label="mysql-secret\n(.my.cnf mount)", shape=cylinder, fillcolor="#fff9c4"];
}
svc [label="mysql-headless\n(3306, 9104)", fillcolor="#e1bee7"];
pvc [label="mysql-data\n(100Gi PVC)", shape=folder, fillcolor="#ffccbc"];
host [label="Host Network\n(127.0.0.1)", shape=cloud, fillcolor="#f5f5f5"];
}
host -> mysql [label="hostNetwork"];
mysql -> exporter [label="localhost:3306"];
secret -> mysql [label="mount: /etc/mysql-check"];
secret -> exporter [label="mount: /etc/mysql-exporter"];
mysql -> pvc [label="mount: /var/lib/mysql"];
svc -> mysql [label="selector"];
}
Deployment Workflow
- Generate Root Password: Create a random 16-character alphanumeric string.
- Generate Secret Manifest: Name
mysql-secret. Must includeMYSQL_ROOT_PASSWORDAND a.my.cnfkey.- .my.cnf Template:
[client] user=root password=${MYSQL_ROOT_PASSWORD} host=127.0.0.1
- .my.cnf Template:
- Generate Headless Service Manifest: Name
mysql-headless, Ports 3306 and 9104. - Generate StatefulSet Manifest:
- Volumes:
check-config: Secretmysql-secret, items:key: .my.cnf, path: .my.cnf.exporter-config: Secretmysql-secret, items:key: .my.cnf, path: .my.cnf.
- Container 1 (mysql):
- Image:
mysql:8.0 - Resources: Request
250m/512Mi, Limit500m/1Gi. - VolumeMounts:
check-configto/etc/mysql-check(readOnly). - Liveness:
exec: ["mysqladmin", "--defaults-extra-file=/etc/mysql-check/.my.cnf", "ping"], initialDelay: 30s. - Readiness:
exec: ["mysql", "--defaults-extra-file=/etc/mysql-check/.my.cnf", "-e", "SELECT 1"], initialDelay: 10s.
- Image:
- Container 2 (exporter):
- Image:
prom/mysqld-exporter:v0.15.1 - Resources: Limit
100m/256Mi. - VolumeMounts:
exporter-configto/etc/mysql-exporter(readOnly). - Args:
["--config.my-cnf=/etc/mysql-exporter/.my.cnf"].
- Image:
- Pod Spec:
hostNetwork: true,terminationGracePeriodSeconds: 30. - VolumeClaimTemplates: Default 100Gi.
- Volumes:
Stress Testing Workflow (sysbench)
... (Same as previous, ensure $MYSQL_ROOT_PASSWORD is used correctly) ...
Reporting & Cleanup Workflow
- Architecture Diagram: Generate
mysql-arch.jpg. - Performance Report: Markdown with JPG, K8s manifests, and sysbench results.
- Cleanup (Standard Deletion):
- Provide command:
kubectl delete sts mysql && kubectl delete svc mysql-headless && kubectl delete secret mysql-secret. - Optional:
kubectl delete pvc -l app=mysql(Warning: deletes data).
- Provide command:
Example Usage
- "Generate a production-ready MySQL report."
- "Show me the deployment and cleanup commands for mysql-skill."
When asked to perform a stress test, follow these steps:
- Prerequisites: Ensure the MySQL pod is running and the
mysql-secretis accessible. - Prepare Test Data:
- Run a temporary pod with
sysbenchor exec into the mysql pod if it has sysbench installed. - Command:
sysbench oltp_read_write --db-driver=mysql --mysql-host=127.0.0.1 --mysql-user=root --mysql-password=$MYSQL_ROOT_PASSWORD --mysql-db=test --tables=10 --table-size=100000 prepare
- Run a temporary pod with
- Run Stress Test:
- Execute the benchmark for a specific duration (e.g., 60s).
- Command:
sysbench oltp_read_write --db-driver=mysql --mysql-host=127.0.0.1 --mysql-user=root --mysql-password=$MYSQL_ROOT_PASSWORD --mysql-db=test --tables=10 --table-size=100000 --threads=16 --time=60 --report-interval=10 run
- Report Results:
- Summarize the Transactions Per Second (TPS), Queries Per Second (QPS), and Latency (95th percentile).
- Cleanup:
- Remove test data.
- Command:
sysbench oltp_read_write --db-driver=mysql --mysql-host=127.0.0.1 --mysql-user=root --mysql-password=$MYSQL_ROOT_PASSWORD --mysql-db=test --tables=10 cleanup
Output Format
- Manifests: A single multi-document YAML file.
- Stress Test: A summary table of results and the commands used.
Example Usage
- "Generate the standard mysql manifests for my cluster."
- "Perform a stress test on my mysql instance."
- "Benchmarking mysql using sysbench."
Weekly Installs
8
Repository
cooloo9871/my-a…me-skillFirst Seen
Feb 28, 2026
Security Audits
Installed on
cline8
gemini-cli8
github-copilot8
codex8
kimi-cli8
cursor8