Skip to content

Instantly share code, notes, and snippets.

@arwilczek90
arwilczek90 / cloud-init.yaml
Created October 3, 2020 19:41
cloudinit k3os
packages:
- zsh
users:
- name: awilczek
ssh-import-id: gh:arwilczek90
shell: /bin/zsh
@arwilczek90
arwilczek90 / kube_secret_diff.sh
Last active March 27, 2020 16:42
This is a shellscript I compiled from various stack overflows to find differences in the secrets I installed vs the secrets that are used and vice versa. this makes trimming legacy/nolonger used secrets easier.
#!/usr/bin/env zsh
printf "Getting used secrets...\n"
# Get envFrom secrets
envSecrets=$(kubectl get pods -o jsonpath='{.items[*].spec.containers[*].envFrom[*].secretRef.name}' | xargs -n1)
# Get valueFrom secrets
envSecrets2=$(kubectl get pods -o jsonpath='{.items[*].spec.containers[*].env[*].valueFrom.secretKeyRef.name}' | xargs -n1)
# Get secrets mounted as volumes
volumeSecrets=$(kubectl get pods -o jsonpath='{.items[*].spec.volumes[*].secret.secretName}' | xargs -n1)
# Get imagePullSecrets
pullSecrets=$(kubectl get pods -o jsonpath='{.items[*].spec.imagePullSecrets[*].name}' | xargs -n1)

Keybase proof

I hereby claim:

  • I am arwilczek90 on github.
  • I am mobiusnone (https://keybase.io/mobiusnone) on keybase.
  • I have a public key ASCD-fTdBLAA-A1AANCsWQB5a03c7Wgs6l3visADUOkbSQo

To claim this, I am signing this object: