Skip to content

Commit 1d9e30d

Browse files
authored
feat(runbooks): k3s + cloudshell-fog DevSecOps runbook library (#51)
Three default runbooks for the cloudshell-fog / k3s twin admin surface: - k3s-cluster-admin: open tunnel, node/pod/event inspection, resource pressure - cloudshell-devsecops: bastion SSH patterns, SOCKS5 proxy, remote exec, scp - k3s-incident-triage: rapid blast-radius + pod failure + OOM + storage diagnosis Searchable via `rb search k3s` or `rb search cloudshell`.
1 parent b6ae388 commit 1d9e30d

3 files changed

Lines changed: 76 additions & 0 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: cloudshell-devsecops
2+
description: "Cloudshell-fog DevSecOps session — bastion SSH, SOCKS5 proxy, remote exec patterns"
3+
tags: [cloudshell, devsecops, ssh, bastion, proxy, k3s]
4+
vars:
5+
REMOTE_CMD: "kubectl get nodes"
6+
SRC: "~/.kube/config-k3s-twin"
7+
DST: "cloudshell:~/.kube/config-k3s-twin"
8+
steps:
9+
- cmd: csh-status
10+
desc: "Print full cloudshell-fog connection config and live tunnel/proxy status."
11+
- cmd: csh-exec "whoami && hostname && uptime"
12+
desc: "Non-interactive smoke-test — verify bastion reachability and identity."
13+
- cmd: csh-exec "${REMOTE_CMD}"
14+
desc: "Run an arbitrary remote command on the cloudshell bastion. Edit REMOTE_CMD var to taste."
15+
- cmd: ktunnel start
16+
desc: "Forward k3s API port (localhost:16443 → k3s-twin:6443) through the bastion."
17+
- cmd: kproxy start
18+
desc: "Open SOCKS5 proxy on localhost:1080 via cloudshell — routes sovereign browsing through the fog network."
19+
- cmd: csh-copy "${SRC}" "${DST}"
20+
desc: "Copy kubeconfig or any file to/from cloudshell via scp. Set SRC/DST vars: prefix 'cloudshell:' for remote side."
21+
- cmd: csh
22+
desc: "Drop into a full interactive SSH session on the cloudshell-fog bastion (CMD+SHIFT+K)."
23+
- cmd: ktunnel stop
24+
desc: "Tear down the k3s API tunnel cleanly when done."
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: k3s-cluster-admin
2+
description: "k3s twin cluster admin — open tunnel, verify connectivity, inspect workloads"
3+
tags: [k3s, devsecops, cloudshell, tunnel, kubectl]
4+
vars:
5+
NAMESPACE: "kube-system"
6+
KUBECONFIG: "${CLOUDSHELL_K3S_KUBECONFIG:-$HOME/.kube/config-k3s-twin}"
7+
steps:
8+
- cmd: csh-status
9+
desc: "Show cloudshell-fog config and current tunnel/proxy state."
10+
- cmd: ktunnel start
11+
desc: "Open k3s API tunnel: localhost:16443 → k3s-twin:6443 via cloudshell-fog bastion. Safe to re-run if already up."
12+
- cmd: k3s get nodes -o wide
13+
desc: "Verify k3s twin reachability and node readiness via the tunnel."
14+
- cmd: k3s get pods -n ${NAMESPACE} --field-selector='status.phase!=Running'
15+
desc: "Surface any pods that are NOT running in the target namespace — the first triage signal."
16+
- cmd: k3s get events -n ${NAMESPACE} --sort-by='.metadata.creationTimestamp' | tail -30
17+
desc: "Last 30 cluster events sorted by timestamp — quick anomaly scan."
18+
- cmd: k3s top nodes
19+
desc: "CPU/memory pressure across nodes (requires metrics-server)."
20+
- cmd: k3s top pods -n ${NAMESPACE} --sort-by=memory
21+
desc: "Top pods by memory in the target namespace."
22+
- cmd: k3s get all -A --show-labels
23+
desc: "Full cluster inventory with labels — useful for verifying GitOps-applied state."
24+
- cmd: ktunnel status
25+
desc: "Confirm tunnel is still alive after the admin session."
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: k3s-incident-triage
2+
description: "k3s twin incident triage — rapid diagnosis for pod failures, OOM, crashloops, storage"
3+
tags: [k3s, devsecops, incident, triage, cloudshell]
4+
vars:
5+
NAMESPACE: "default"
6+
POD: ""
7+
steps:
8+
- cmd: ktunnel start
9+
desc: "Ensure k3s API tunnel is open. Safe to re-run."
10+
- cmd: k3s get pods -A --field-selector='status.phase!=Running' -o wide
11+
desc: "All non-running pods across every namespace — the incident blast radius at a glance."
12+
- cmd: k3s get events -A --field-selector='type=Warning' --sort-by='.metadata.creationTimestamp' | tail -40
13+
desc: "Warning events cluster-wide, newest last."
14+
- cmd: k3s describe pod ${POD} -n ${NAMESPACE}
15+
desc: "Full pod description for the affected pod. Set POD var to the pod name."
16+
- cmd: k3s logs ${POD} -n ${NAMESPACE} --previous --tail=100
17+
desc: "Logs from the previous (crashed) container instance — the real error trace."
18+
- cmd: k3s logs ${POD} -n ${NAMESPACE} --tail=100
19+
desc: "Logs from the current container instance."
20+
- cmd: k3s get pvc -n ${NAMESPACE}
21+
desc: "PVC status in the affected namespace — catch Pending volumes blocking pod scheduling."
22+
- cmd: k3s describe node $(k3s get pods ${POD} -n ${NAMESPACE} -o jsonpath='{.spec.nodeName}')
23+
desc: "Node conditions and allocatable resources for the pod's assigned node."
24+
- cmd: csh-exec "journalctl -u k3s --since '30 minutes ago' | tail -60"
25+
desc: "k3s systemd service journal on the cloudshell-fog host — catches API server and etcd panics."
26+
- cmd: k3s rollout restart deployment/${POD%-*} -n ${NAMESPACE}
27+
desc: "Controlled rollout restart of the affected deployment. Only run after diagnosing root cause."

0 commit comments

Comments
 (0)