Start M8.1 inventory: stated facts, workload profile and collectors
Record the maintainer-stated host facts (R730xd ~128 GB, 32 GB workers, automatic Harbor publish and Argo CD deploy, existing aevolution-db Secret and its conflicts with the pinned version and role split), the measured evo-server profile (peak RSS ~9.7 MiB, ~0.3% of a core) and a local storage baseline. Add a read-only cluster collector that never fetches Secret data and a by-hand storage latency probe outside the Argo path. Cluster facts remain uninspected pending read-only access. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env bash
|
||||
# M8.1 read-only cluster inventory. Run with a kubeconfig whose identity can only
|
||||
# get/list (cluster-reader); it never creates, patches or deletes anything, and it
|
||||
# never fetches Secret or ConfigMap data: Secrets are listed only through the
|
||||
# server-side table (namespace, name, type, number of keys).
|
||||
#
|
||||
# tools/inventory/collect-cluster.sh <output-dir> [context]
|
||||
#
|
||||
# Review the output before sharing it: node names, addresses, hostnames and image
|
||||
# references are infrastructure details, not credentials, but they are not public.
|
||||
set -uo pipefail
|
||||
out="${1:?output directory}"
|
||||
context="${2:-}"
|
||||
mkdir -p "$out"
|
||||
chmod 700 "$out"
|
||||
k=(kubectl --request-timeout=20s)
|
||||
[ -n "$context" ] && k+=(--context "$context")
|
||||
|
||||
run() { # run <file> <command...>; failures are recorded, not fatal (missing CRDs).
|
||||
local file="$out/$1"; shift
|
||||
{ echo "\$ ${*}"; "$@" 2>&1; echo "exit=$?"; } > "$file"
|
||||
}
|
||||
|
||||
run version.txt "${k[@]}" version
|
||||
run whoami.txt "${k[@]}" auth whoami
|
||||
run can-i.txt "${k[@]}" auth can-i --list
|
||||
run api-resources.txt "${k[@]}" api-resources -o wide
|
||||
# Nodes: capacity, allocatable, pressure, labels, taints, kernel/runtime, usage.
|
||||
run nodes.txt "${k[@]}" get nodes -o wide --show-labels
|
||||
run node-resources.txt "${k[@]}" get nodes -o custom-columns='NAME:.metadata.name,CPU:.status.capacity.cpu,MEM:.status.capacity.memory,EPHEMERAL:.status.capacity.ephemeral-storage,PODS:.status.capacity.pods,ALLOC_CPU:.status.allocatable.cpu,ALLOC_MEM:.status.allocatable.memory,ALLOC_EPHEMERAL:.status.allocatable.ephemeral-storage,TAINTS:.spec.taints[*].key'
|
||||
run nodes-describe.txt "${k[@]}" describe nodes
|
||||
run top-nodes.txt "${k[@]}" top nodes
|
||||
run top-pods.txt "${k[@]}" top pods -A --sort-by=memory
|
||||
# Storage: classes, reclaim/binding modes, volumes and their node affinity, CSI.
|
||||
run storageclasses.txt "${k[@]}" get storageclass -o custom-columns='NAME:.metadata.name,PROVISIONER:.provisioner,RECLAIM:.reclaimPolicy,BINDING:.volumeBindingMode,EXPAND:.allowVolumeExpansion,DEFAULT:.metadata.annotations.storageclass\.kubernetes\.io/is-default-class'
|
||||
run storageclasses.yaml "${k[@]}" get storageclass -o yaml
|
||||
run pv.txt "${k[@]}" get pv -o custom-columns='NAME:.metadata.name,CAPACITY:.spec.capacity.storage,RECLAIM:.spec.persistentVolumeReclaimPolicy,CLASS:.spec.storageClassName,STATUS:.status.phase,CLAIM:.spec.claimRef.namespace,CLAIMNAME:.spec.claimRef.name,NODE_AFFINITY:.spec.nodeAffinity.required.nodeSelectorTerms[*].matchExpressions[*].values'
|
||||
run pvc.txt "${k[@]}" get pvc -A -o wide
|
||||
run csidrivers.txt "${k[@]}" get csidrivers -o wide
|
||||
run csinodes.txt "${k[@]}" get csinodes -o wide
|
||||
run volumesnapshotclasses.txt "${k[@]}" get volumesnapshotclasses
|
||||
# Network: CNI and other node agents, policies, ingress, load balancers, DNS.
|
||||
run daemonsets.txt "${k[@]}" get daemonsets -A -o wide
|
||||
run kube-system-pods.txt "${k[@]}" get pods -n kube-system -o wide
|
||||
run networkpolicies.txt "${k[@]}" get networkpolicies -A
|
||||
run ingressclasses.txt "${k[@]}" get ingressclass -o wide
|
||||
run ingresses.txt "${k[@]}" get ingress -A -o wide
|
||||
run loadbalancers.txt "${k[@]}" get services -A --field-selector spec.type=LoadBalancer -o wide
|
||||
run coredns.txt "${k[@]}" get deploy,svc -n kube-system -l k8s-app=kube-dns -o wide
|
||||
run cert-issuers.txt "${k[@]}" get clusterissuers,issuers -A
|
||||
run certificates.txt "${k[@]}" get certificates -A
|
||||
# Workloads, quotas and scheduling policy.
|
||||
run namespaces.txt "${k[@]}" get namespaces --show-labels
|
||||
run workloads.txt "${k[@]}" get deploy,statefulset,daemonset,job,cronjob -A -o wide
|
||||
run quotas.txt "${k[@]}" get resourcequota,limitrange -A
|
||||
run priorityclasses.txt "${k[@]}" get priorityclasses
|
||||
run pdbs.txt "${k[@]}" get pdb -A
|
||||
# Delivery: Argo CD applications, their sources and sync policies (auto-sync/prune).
|
||||
run argocd-apps.txt "${k[@]}" get applications.argoproj.io -A -o custom-columns='NS:.metadata.namespace,NAME:.metadata.name,PROJECT:.spec.project,REPO:.spec.source.repoURL,PATH:.spec.source.path,REVISION:.spec.source.targetRevision,DEST_NS:.spec.destination.namespace,AUTOMATED:.spec.syncPolicy.automated,SYNC:.status.sync.status,HEALTH:.status.health.status'
|
||||
run argocd-projects.yaml "${k[@]}" get appprojects.argoproj.io -A -o yaml
|
||||
# Target namespace: what already runs there. Secrets are listed with the default
|
||||
# server-side table (namespace, name, type, key count): values are never fetched.
|
||||
run evolution-dev.txt "${k[@]}" get all,pvc,networkpolicy,serviceaccount -n evolution-dev -o wide
|
||||
run secrets.txt "${k[@]}" get secrets -A
|
||||
echo "inventory written to $out (review before sharing)"
|
||||
Reference in New Issue
Block a user