Cloudflare GraphQL Analytics for zone traffic, firewall events, Workers metrics, and schema exploration. Use when querying Cloudflare analytics data or exploring the GraphQL API.
中文简介正在准备中。当前显示原文说明。
Use when working with Coredns — coreDNS server management, zone configuration, plugin chain analysis, query logging, and cache statistics. Covers Corefile inspection, health endpoint monitoring, metrics collection, and forwarding configuration. Read this skill before any CoreDNS operations — it enforces discovery-first patterns, anti-hallucination rules, and safety constraints.
中文简介正在准备中。当前显示原文说明。
安装前可以查看交给 AI 代理的指令内容。
Monitor, analyze, and manage CoreDNS servers safely.
Always inspect the Corefile and running metrics before making changes. Never guess zone names or plugin chains.
#!/bin/bash
COREDNS_METRICS="${COREDNS_METRICS:-http://localhost:9153}"
COREFILE="${COREFILE:-/etc/coredns/Corefile}"
echo "=== CoreDNS Version ==="
coredns -version 2>/dev/null || echo "coredns binary not in PATH — check container/pod"
echo ""
echo "=== Corefile Contents ==="
cat "$COREFILE" 2>/dev/null || \
kubectl -n kube-system get configmap coredns -o jsonpath='{.data.Corefile}' 2>/dev/null || \
echo "Corefile not found at $COREFILE"
echo ""
echo "=== Running Process ==="
ps aux | grep '[c]oredns' | awk '{print $1, $2, $11, $12, $13}'
echo ""
echo "=== Health Check ==="
curl -s http://localhost:8080/health 2>/dev/null || echo "Health endpoint not reachable"
echo ""
echo "=== Ready Check ==="
curl -s http://localhost:8181/ready 2>/dev/null || echo "Ready endpoint not reachable"
echo ""
echo "=== DNS Test Query ==="
dig @127.0.0.1 -p 53 version.bind TXT CH +short 2>/dev/null || echo "DNS port not reachable locally"
Phase 1 outputs: Zone definitions, plugin chain per zone, listening ports, forwarding targets
Only inspect zones and plugins confirmed in Phase 1 Corefile output.
forward directivescoredns -conf Corefile -dns.port 15353 on a test port before applying#!/bin/bash
COREDNS_METRICS="${COREDNS_METRICS:-http://localhost:9153}"
# Query CoreDNS metrics
coredns_metrics() {
curl -s "$COREDNS_METRICS/metrics"
}
# Parse zones from Corefile
list_zones() {
local corefile="${1:-/etc/coredns/Corefile}"
awk '/^[a-zA-Z0-9.:]+\s*\{/ || /^[a-zA-Z0-9.:]+\s*$/ {
gsub(/\{/,""); gsub(/\s+/,""); if ($0 != "") print $0
}' "$corefile" 2>/dev/null
}
# Test DNS resolution
dns_test() {
local name="$1"
local type="${2:-A}"
local server="${3:-127.0.0.1}"
dig @"$server" "$name" "$type" +short +time=2
}
# Get plugin chain for a zone
zone_plugins() {
local zone="$1"
local corefile="${2:-/etc/coredns/Corefile}"
awk -v zone="$zone" '
$0 ~ zone { found=1; next }
found && /\}/ { found=0 }
found { gsub(/^[ \t]+/, ""); print }
' "$corefile" 2>/dev/null
}
#!/bin/bash
COREFILE="${COREFILE:-/etc/coredns/Corefile}"
echo "=== Zone Definitions ==="
awk '
/^[^ \t#].*\{/ {
zone=$1; plugins=""
while (getline > 0 && !/^\}/) {
gsub(/^[ \t]+/, "")
if ($0 != "" && $0 !~ /^#/) plugins = plugins " " $1
}
printf "Zone: %-30s Plugins:%s\n", zone, plugins
}
' "$COREFILE" 2>/dev/null
echo ""
echo "=== Forward Targets ==="
grep -E '^\s*forward' "$COREFILE" 2>/dev/null | while read _ zone targets; do
echo "Zone forward: $zone -> $targets"
done
echo ""
echo "=== Zone File References ==="
grep -E '^\s*file\s' "$COREFILE" 2>/dev/null
#!/bin/bash
COREFILE="${COREFILE:-/etc/coredns/Corefile}"
echo "=== Plugin Chains (execution order) ==="
awk '
/^[^ \t#].*\{/ { zone=$1; idx=0 }
/^\s+[a-z]/ && zone {
gsub(/^[ \t]+/, "")
plugin=$1
idx++
printf "%s [%d] %s\n", zone, idx, plugin
}
/^\}/ { zone="" }
' "$COREFILE" 2>/dev/null
echo ""
echo "=== Kubernetes Plugin Config ==="
awk '
/kubernetes/ { found=1; print "kubernetes plugin found:" }
found { print " " $0 }
found && /\}/ { found=0 }
' "$COREFILE" 2>/dev/null || echo "No kubernetes plugin configured"
#!/bin/bash
echo "=== DNS Query Metrics ==="
coredns_metrics 2>/dev/null | grep -E '^coredns_dns_request' | head -20
echo ""
echo "=== Response Codes ==="
coredns_metrics 2>/dev/null | grep 'coredns_dns_responses_total' | \
awk -F'[{}]' '{print $2}' | sort | head -20
echo ""
echo "=== Request Duration ==="
coredns_metrics 2>/dev/null | grep 'coredns_dns_request_duration_seconds' | \
grep -E '_sum|_count' | head -10
echo ""
echo "=== Query Log (if log plugin enabled) ==="
journalctl -u coredns --no-pager -n 50 2>/dev/null || \
kubectl -n kube-system logs -l k8s-app=kube-dns --tail=50 2>/dev/null || \
echo "Check container/pod logs for query log"
#!/bin/bash
echo "=== Cache Hit/Miss Rates ==="
coredns_metrics 2>/dev/null | grep 'coredns_cache' | grep -v '^#'
echo ""
echo "=== Cache Size ==="
coredns_metrics 2>/dev/null | grep 'coredns_cache_entries' | \
awk '{printf "%-60s entries=%s\n", $1, $2}'
echo ""
echo "=== Cache Hit Ratio ==="
coredns_metrics 2>/dev/null | awk '
/coredns_cache_hits_total/ { hits+=$2 }
/coredns_cache_misses_total/ { misses+=$2 }
END {
total=hits+misses
if (total > 0) printf "Cache hit rate: %.1f%% (hits=%d misses=%d)\n", hits/total*100, hits, misses
}
'
Present results as a structured report:
Managing Coredns Report
═══════════════════════
Resources discovered: [count]
Resource Status Key Metric Issues
──────────────────────────────────────────────
[name] [ok/warn] [value] [findings]
Summary: [total] resources | [ok] healthy | [warn] warnings | [crit] critical
Action Items: [list of prioritized findings]
Target ≤50 lines of output. Use tables for multi-resource comparisons.
| Shortcut | Counter | Why |
|---|---|---|
| "I'll skip discovery and check known resources" | Always run Phase 1 discovery first | Resource names change, new resources appear — assumed names cause errors |
| "The user only asked for a quick check" | Follow the full discovery → analysis flow | Quick checks miss critical issues; structured analysis catches silent failures |
| "Default configuration is probably fine" | Audit configuration explicitly | Defaults often leave logging, security, and optimization features disabled |
| "Metrics aren't needed for this" | Always check relevant metrics when available | API/CLI responses show current state; metrics reveal trends and intermittent issues |
| "I don't have access to that" | Try the command and report the actual error | Assumed permission failures prevent useful investigation; actual errors are informative |
errors should come before log; cache before forward — wrong order means plugins are skippedkubernetes plugin must match the cluster domain (default: cluster.local)proxy plugin is deprecated — always use forward/health (8080) and /ready (8181) are separate — liveness uses health, readiness uses readyloop plugin detects forwarding loops — if CoreDNS crashes with loop, check forward targets还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Cloudflare GraphQL Analytics for zone traffic, firewall events, Workers metrics, and schema exploration. Use when querying Cloudflare analytics data or exploring the GraphQL API.
中文简介正在准备中。当前显示原文说明。
Use when working with Alloydb — google AlloyDB instance analysis, query insights, columnar engine optimization, maintenance windows, and cluster health.
中文简介正在准备中。当前显示原文说明。
Use when working with Aqua — aqua Security platform analysis. Covers container runtime protection, image assurance policies, compliance frameworks, vulnerability management, workload protection, and registry scanning. Use when analyzing container security posture, reviewing image compliance, investigating runtime alerts, or auditing security policies.
中文简介正在准备中。当前显示原文说明。
Use when working with Bigquery — google BigQuery job analysis, slot utilization, cost analysis, dataset management, and query optimization.
中文简介正在准备中。当前显示原文说明。
Use when working with Cassandra — apache Cassandra keyspace analysis, compaction strategies, repair status, nodetool operations, and cluster health monitoring.
中文简介正在准备中。当前显示原文说明。
Use when working with Checkov — checkov infrastructure-as-code security scanning. Covers Terraform, CloudFormation, Kubernetes, and Dockerfile scanning, policy management, custom checks, compliance frameworks, and suppression management. Use when scanning IaC for security misconfigurations, evaluating compliance, managing custom policies, or reviewing scan results.
中文简介正在准备中。当前显示原文说明。