Skip to content

Instantly share code, notes, and snippets.

View seanslma's full-sized avatar

Sean seanslma

View GitHub Profile
@seanslma
seanslma / delete_registry_repos.sh
Created February 4, 2025 23:29
Delete digests in specified registry repos
#!/bin/bash
# This script removes all tags in specified namespaces from local registry
# after this script run, run the following script to free the space:
# bin/registry garbage-collect /etc/docker/registry/config.yml
#
# Examples (dryrun and execution):
# ./delete_registry_repos.sh -r http://registry.local:5000 -n dev
# ./delete_registry_repos.sh -r https://registry.example.com -n dev,pr -d
#
# You can set the default value in the script so no input for -r -n
@seanslma
seanslma / delete_completed_error_pods.sh
Created December 16, 2024 00:07
Delete pods in kubernetes that are with the status of either completed or error
#!/bin/bash
# Check if kubectl is configured to connect to the AKS cluster
if ! command -v kubectl &> /dev/null
then
echo "kubectl could not be found. Please install kubectl and configure it to access your AKS cluster."
exit 1
fi
# Get the list of pods that are either in Completed or Error state
@seanslma
seanslma / pods_disk_usage.sh
Created December 16, 2024 00:04
List the pod disk usage for each pod in kubernetes
#!/bin/bash
# Check if kubectl is configured to connect to AKS cluster
if ! command -v kubectl &> /dev/null
then
echo "kubectl could not be found. Please install kubectl and configure it to access your AKS cluster."
exit 1
fi
# Get the list of all pods in the cluster
#!/bin/bash
# This script removes tags from local registry, keeping just the n most recents tags
# after this script run, run the following script to free the space:
# bin/registry garbage-collect /etc/docker/registry/config.yml
#
# Examples (dryrun and execution):
# ./delete_registry_digests.sh -r http://registry.local:5000 -i test -k 0
# ./delete_registry_digests.sh -r https://registry.example.com -i dev/test -e latest -d
#
# After deleting all the tags, run garbage collection: