Skip to content

Instantly share code, notes, and snippets.

View mrsimonemms's full-sized avatar
🐝
Tinkerin'

Simon Emms mrsimonemms

🐝
Tinkerin'
View GitHub Profile
@mrsimonemms
mrsimonemms / script.sh
Created July 2, 2024 14:10
Extract Kubernetes TLS secrets to YAML
#!/bin/bash
# Extract secrets from all namespaces
kubectl get secrets -A --field-selector=type=kubernetes.io/tls -o json | jq -r '.items[]' | yq -p=json
# Extract secrets from a single namespace
kubectl get secrets -n default --field-selector=type=kubernetes.io/tls -o json | jq -r '.items[]' | yq -p=json