Skip to content

Commit d79d6df

Browse files
committed
Add shebang to bash code blocks
1 parent cd59c32 commit d79d6df

25 files changed

Lines changed: 156 additions & 1 deletion

File tree

  • src
    • content/articles
      • argocd-sync-failures-gitops-debugging-troubleshooting
      • database-schema-migrations-continuous-deployment-zero-downtime
      • eol-runtime-upgrade-dependency-hell-migration
      • helm-release-management-drift-detection-debugging
      • kubernetes-cluster-upgrade-playbook-risk-reduction
      • kubernetes-dns-debugging-ndots-coredns-troubleshooting
      • kubernetes-hpa-autoscaling-metrics-tuning-latency
      • kubernetes-pod-disruption-budget-autoscaler-node-rotation
      • monorepo-affected-builds-remote-caching-ci-optimization
      • mtls-certificate-rotation-service-mesh-authentication
      • opa-conftest-policy-as-code-infrastructure-guardrails
      • openapi-spec-documentation-sdk-generation-validation
      • prometheus-high-cardinality-metrics-label-design
      • service-catalog-metadata-schema-ownership-tracking
      • service-decommissioning-scream-test-shutdown
      • terraform-state-locking-corruption-recovery-backend
    • lib

‎_TODO.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,8 @@ See comp images in Breadcrumbs component directory
243243

244244
- Newsletter component "home" and "page" variants needs work on spacing, "home" needs image added
245245

246+
- Determine if any of the python code blocks should have `#!/bin/python` added
247+
246248
## Header
247249

248250
- Need to improve the "squish" animation where the header reduces in size on scroll down, and returns to full size on scroll up. Maybe reduce and expand the text and search / themepicker / hamburger menu sizes in place, and then slide them horizontally.

‎src/content/articles/argocd-sync-failures-gitops-debugging-troubleshooting/index.mdx‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ When sync fails, resist the urge to poke at random things. A systematic approach
9898
Start broad and narrow down:
9999

100100
```bash title="debug-argocd-sync.sh"
101+
#!/bin/bash
102+
101103
# Get application status overview
102104
argocd app get myapp
103105
@@ -124,6 +126,8 @@ The `--show-operation` flag shows which phase the sync is in. "Running PreSync h
124126
ArgoCD has several components, each handling different parts:
125127

126128
```bash title="check-argocd-logs.sh"
129+
#!/bin/bash
130+
127131
# Application controller logs (sync decisions, health checks)
128132
kubectl logs -n argocd -l app.kubernetes.io/name=argocd-application-controller | grep "myapp"
129133
@@ -139,6 +143,8 @@ Most sync failures show up in application-controller logs. If you're seeing "man
139143
ArgoCD reports what Kubernetes tells it. Verify what's actually happening:
140144

141145
```bash title="inspect-kubernetes-state.sh"
146+
#!/bin/bash
147+
142148
# Check pod status and events
143149
kubectl get pods -n myapp
144150
kubectl describe pod -n myapp -l app=myapp
@@ -155,6 +161,8 @@ The `kubectl describe` Events section is often the most useful—it shows why po
155161
ArgoCD provides options for testing before committing:
156162

157163
```bash title="test-argocd-fix.sh"
164+
#!/bin/bash
165+
158166
# Dry-run to see what would happen
159167
argocd app sync myapp --dry-run
160168

‎src/content/articles/argocd-sync-failures-gitops-debugging-troubleshooting/pdf.mdx‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ When a dependency is missing, pods fail to start with characteristic error messa
226226
The fix is usually straightforward: put the dependency in an earlier sync wave. But first you need to identify which dependency is missing:
227227

228228
```bash title="debug-dependency-failure.sh"
229+
#!/bin/bash
230+
229231
# Check what secrets a deployment needs
230232
kubectl get deployment app -o jsonpath='{.spec.template.spec.containers[*].envFrom[*].secretRef.name}'
231233
@@ -402,6 +404,8 @@ Now that you understand _what_ can fail, let's talk about _how_ to investigate w
402404
Start broad and narrow down. The ArgoCD CLI gives you a quick overview of what's happening:
403405

404406
```bash title="debug-step-1.sh"
407+
#!/bin/bash
408+
405409
# Get application status overview
406410
argocd app get myapp
407411
@@ -425,6 +429,8 @@ The `--show-operation` flag shows the current or last sync operation, including
425429
Once you know roughly where the failure is, check the logs for the relevant ArgoCD component. ArgoCD has several pods, and each handles different parts of the sync process:
426430

427431
```bash title="debug-step-2.sh"
432+
#!/bin/bash
433+
428434
# ArgoCD application controller logs (sync decisions)
429435
kubectl logs -n argocd -l app.kubernetes.io/name=argocd-application-controller -f
430436
@@ -455,6 +461,8 @@ Most sync failures show up in the application-controller logs. If your issue is
455461
ArgoCD's view of the world comes from Kubernetes, so when ArgoCD reports a problem, verify what's actually happening in the cluster. Sometimes ArgoCD's status is stale, or the problem is a Kubernetes issue that ArgoCD is just reporting.
456462

457463
```bash title="debug-step-3.sh"
464+
#!/bin/bash
465+
458466
# Check deployment rollout status
459467
kubectl rollout status deployment/app -n myapp
460468
@@ -480,6 +488,8 @@ The `kubectl describe` output for pods is often the most useful. Look at the Eve
480488
Once you understand the failure, you need to fix it and verify the fix works. ArgoCD provides several options for testing changes before committing them:
481489

482490
```bash title="debug-step-4.sh"
491+
#!/bin/bash
492+
483493
# Dry-run sync to see what would happen
484494
argocd app sync myapp --dry-run
485495
@@ -899,6 +909,8 @@ ArgoCD doesn't deploy your YAML files directly—it renders them through Helm, K
899909
The most common surprise is values resolution in Helm. ArgoCD might be using different values files than you're testing locally, or environment-specific overrides might not be applied in the order you expect.
900910

901911
```bash title="debug-manifest-generation.sh"
912+
#!/bin/bash
913+
902914
# See what ArgoCD generates from your repo
903915
argocd app manifests myapp
904916
@@ -927,6 +939,8 @@ The `argocd app manifests` command is your friend here—it shows you exactly wh
927939
Sometimes ArgoCD's internal state becomes inconsistent with reality. This can happen after failed upgrades, network partitions, or manual resource modifications that confuse the controller. The symptoms vary—perpetual OutOfSync, missing resources in the UI, or sync operations that silently do nothing.
928940

929941
```bash title="recovery-commands.sh"
942+
#!/bin/bash
943+
930944
# Step 1: Try this first - force refresh from Git
931945
argocd app get myapp --hard-refresh
932946

‎src/content/articles/database-schema-migrations-continuous-deployment-zero-downtime/pdf.mdx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,8 @@ What makes gh-ost particularly useful in production: you can pause and resume mi
473473
Here's a typical gh-ost invocation for adding a column:
474474

475475
```bash title="gh-ost-example.sh"
476+
#!/bin/bash
477+
476478
# Add column to large MySQL table without locking
477479

478480
gh-ost \

‎src/content/articles/eol-runtime-upgrade-dependency-hell-migration/pdf.mdx‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ The diagram shows a typical pattern: three direct dependencies fan out to ten tr
9595
Your first step is making this hidden graph visible. Every package manager provides tooling to dump the full tree and trace why a particular package exists in your dependency graph.
9696

9797
```bash title="visualizing-dependency-depth.sh"
98+
#!/bin/bash
99+
98100
# npm: Show full dependency tree
99101
npm ls --all
100102

@@ -218,6 +220,8 @@ Web Forms deserves special mention. There is no migration path. If your applicat
218220
Microsoft provides tooling to help analyze and automate parts of the migration. The .NET Upgrade Assistant scans your solution, identifies incompatibilities, and can perform some automated transformations.
219221

220222
```bash title="dotnet-upgrade-assistant.sh"
223+
#!/bin/bash
224+
221225
# Install the .NET Upgrade Assistant
222226
dotnet tool install -g upgrade-assistant
223227

@@ -274,6 +278,8 @@ Native modules are compiled C++ addons that link against Node's internal APIs. W
274278
The first step is identifying which packages in your dependency tree include native code. Any package with a `.node` file in its build output is a native module.
275279

276280
```bash title="find-native-modules.sh"
281+
#!/bin/bash
282+
277283
# List all native modules in your project
278284
find node_modules -name "*.node" -type f 2>/dev/null | \
279285
sed 's|node_modules/||' | \
@@ -492,6 +498,8 @@ Overrides change _which version_ is installed. Patches change _the code itself_
492498
The `patch-package` tool for npm/yarn makes this workflow practical:
493499

494500
```bash title="patch-workflow.sh"
501+
#!/bin/bash
502+
495503
# Install the tool
496504
npm install patch-package --save-dev
497505

‎src/content/articles/helm-release-management-drift-detection-debugging/index.mdx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ The best time to discover drift is during business hours, not during an incident
5959
Install it and run it against your releases:
6060

6161
```bash title="drift-check.sh"
62+
#!/bin/bash
63+
6264
# Install the helm-diff plugin
6365
helm plugin install https://github.com/databus23/helm-diff
6466

‎src/content/articles/helm-release-management-drift-detection-debugging/pdf.mdx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ Knowing drift happens isn't enough—you need to catch it before it causes probl
122122
The `helm-diff` plugin is the quickest way to compare Helm's view against cluster reality. It shows what would change on an upgrade, but more importantly for drift detection, it can compare the current release against live state.
123123

124124
```bash title="drift-check.sh"
125+
#!/bin/bash
126+
125127
# Install the plugin once
126128
helm plugin install https://github.com/databus23/helm-diff
127129
@@ -334,6 +336,8 @@ _Rolling namespace upgrades_ work well for multi-tenant deployments where each n
334336
For zero-downtime requirements on stateless services, you can run two releases side-by-side:
335337

336338
```bash
339+
#!/bin/bash
340+
337341
# Deploy new version as separate release
338342
helm install my-app-v2 ./my-chart \
339343
--namespace production \

‎src/content/articles/kubernetes-cluster-upgrade-playbook-risk-reduction/pdf.mdx‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ _Cluster health_ establishes your baseline. All nodes should show Ready status.
4646
_Backup and recovery_ is your safety net. Take an etcd snapshot before starting. Document current cluster state with `kubectl get all -A -o yaml`. Most importantly, document and _test_ your rollback procedure in a non-production environment before you need it.
4747

4848
```bash
49+
#!/bin/bash
50+
4951
# Take etcd backup before upgrade (kubeadm clusters)
5052
etcdctl snapshot save /backup/etcd-pre-upgrade-$(date +%Y%m%d).db \
5153
--endpoints=https://127.0.0.1:2379 \
@@ -148,6 +150,8 @@ _Phase 3: Add-ons_ (15-30 minutes). Upgrade cluster add-ons to versions compatib
148150
_Phase 4: Worker nodes_ (10-15 minutes per node). For each worker node: cordon it (prevent new pod scheduling), drain it (evict existing pods), upgrade the kubelet, then uncordon it. Verify the node shows Ready before moving to the next one.
149151

150152
```bash
153+
#!/bin/bash
154+
151155
# Worker node upgrade sequence
152156
NODE="worker-1"
153157
kubectl cordon $NODE
@@ -230,6 +234,8 @@ For production clusters, I recommend blue-green node pools. The sequence:
230234
7. If healthy, delete the old pool. If not, uncordon the old pool and delete the new one.
231235

232236
```bash title="blue-green-node-pool.sh"
237+
#!/bin/bash
238+
233239
# Blue-green node pool upgrade for EKS
234240
OLD_POOL="workers-1-28"
235241
NEW_POOL="workers-1-29"
@@ -270,6 +276,8 @@ Control plane rollback is the nuclear option. It's disruptive, risky, and should
270276
For self-managed clusters (kubeadm), rollback means restoring from the etcd backup you took before upgrading. This is why that backup isn't optional.
271277

272278
```bash title="etcd-restore.sh"
279+
#!/bin/bash
280+
273281
# Stop all control plane components
274282
systemctl stop kube-apiserver kube-controller-manager kube-scheduler etcd
275283

@@ -376,6 +384,8 @@ I organize post-upgrade checks into five categories, run in order of criticality
376384
_Infrastructure checks_ verify the cluster itself is healthy. All nodes should be Ready, control plane components should show healthy status, and the API server should respond quickly. These are blocking - don't proceed if any fail.
377385
378386
```bash
387+
#!/bin/bash
388+
379389
# Infrastructure validation
380390
echo "=== Infrastructure Checks ==="
381391

‎src/content/articles/kubernetes-dns-debugging-ndots-coredns-troubleshooting/index.mdx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ Before optimizing, confirm that ndots is actually your problem. The diagnostic t
6363
First, launch a debug pod with DNS tools:
6464

6565
```bash title="launch-debug-pod.sh"
66+
#!/bin/bash
67+
6668
kubectl run dns-debug --image=nicolaka/netshoot --rm -it --restart=Never -- bash
6769
```
6870

@@ -71,6 +73,8 @@ Code: Launch a debug pod with DNS tools.
7173
Once inside the pod, compare resolution times with and without the trailing dot:
7274

7375
```bash title="ndots-diagnostic.sh"
76+
#!/bin/bash
77+
7478
# Test without trailing dot (search domains applied)
7579
time nslookup api.stripe.com
7680

‎src/content/articles/kubernetes-dns-debugging-ndots-coredns-troubleshooting/pdf.mdx‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ The key components work together: every pod gets a `/etc/resolv.conf` that point
9090
Every debugging session should start by examining the pod's DNS configuration. The `resolv.conf` file tells you exactly which nameserver the pod uses, which search domains get appended, and crucially, the ndots setting that controls when those search domains apply.
9191

9292
```bash title="examining-resolv-conf.sh"
93+
#!/bin/bash
94+
9395
# Examine DNS configuration in a pod
9496
kubectl exec -it debug-pod -- cat /etc/resolv.conf
9597
# Output:
@@ -195,6 +197,8 @@ The difference between `ndots:5` and `ndots:2` for an external API call is three
195197
Before optimizing, measure the actual impact in your cluster. The difference between `nslookup api.stripe.com` and `nslookup api.stripe.com.` tells you exactly how much overhead the search domains add.
196198

197199
```bash title="launch-debug-pod.sh"
200+
#!/bin/bash
201+
198202
# Spin up a debug pod with DNS tools
199203
kubectl run dns-debug --image=nicolaka/netshoot --rm -it --restart=Never -- bash
200204
```
@@ -204,6 +208,8 @@ Code: Launch a debug pod with DNS tools.
204208
Once you're inside the pod, compare resolution times with and without the trailing dot:
205209

206210
```bash title="measure-ndots-inside-pod.sh"
211+
#!/bin/bash
212+
207213
# Compare resolution times
208214
echo "Without trailing dot (search domains applied):"
209215
time nslookup api.stripe.com
@@ -415,6 +421,8 @@ When DNS breaks, you need a systematic approach that quickly narrows down the pr
415421
Start by verifying the DNS infrastructure is healthy, then test from a pod to isolate pod-level versus cluster-level issues.
416422

417423
```bash title="dns-quick-check.sh"
424+
#!/bin/bash
425+
418426
# Step 1: Is CoreDNS running?
419427
kubectl get pods -n kube-system -l k8s-app=kube-dns
420428
kubectl get endpoints -n kube-system kube-dns
@@ -432,6 +440,8 @@ Code: Quick CoreDNS health check.
432440
Once you've verified CoreDNS is running, test from inside a pod. This is critical because node-level DNS and pod-level DNS are configured differently.
433441

434442
```bash title="launch-dns-debug-pod.sh"
443+
#!/bin/bash
444+
435445
# Spin up a debug pod with DNS tools
436446
kubectl run dns-debug --image=nicolaka/netshoot --rm -it --restart=Never -- bash
437447
```
@@ -441,6 +451,8 @@ Code: Launch a debug pod.
441451
Once inside the pod, run through this diagnostic sequence:
442452

443453
```bash title="dns-diagnostic-sequence.sh"
454+
#!/bin/bash
455+
444456
cat /etc/resolv.conf # Check DNS config
445457
nslookup kubernetes.default # Test internal DNS
446458
nslookup google.com # Test external DNS

0 commit comments

Comments
 (0)