Skip to content

Instantly share code, notes, and snippets.

View AndreySemechkov's full-sized avatar

Andrey Semetchkov AndreySemechkov

View GitHub Profile
@AndreySemechkov
AndreySemechkov / kind_load_podman.sh
Created August 28, 2023 21:23
Use podman built images with kind load by pushing latest image to local kind cluster as an oci-archive. Overcoming docker oriented defaults
echo "Pushing latest image to local kind cluster"
export KIND_EXPERIMENTAL_PROVIDER=podman
podman save <IMAGE> --format oci-archive -o ~/<IMAGE>
# loading to kind cluster named home-cluster
kind load image-archive ~/<IMAGE> --name home-cluster
@AndreySemechkov
AndreySemechkov / get_vol_attachments.sh
Created August 6, 2023 19:18
Echo detailed info from CSI on volume attachments to EKS nodes. Helped monitor issue with volume attaching to EKS nodes
region='eu-west-1'
ec2_filter='karpenter.sh/provisioner-name/*'
ec2_ids=$(aws ec2 describe-instances --filters "Name=tag:Name,Values=${ec2_filter}" --region ${region} | jq --raw-output .Reservations[].Instances[].InstanceId)
info=$(aws ec2 describe-instances --instance-ids ${ec2_ids} --query 'Reservations[*].Instances[*].[InstanceId,BlockDeviceMappings[*].Ebs.[Status,VolumeId,AttachTime]]' --region ${region} )
echo ${info} | jq 'map( .[0][0] as $instance_id | .[0][1] as $volumes | { "Instance_id": $instance_id, "Volume": $volumes | length, "Attached volume": ($volumes | map(select(.[0] == "attached")) | length), "Attaching volume": ($volumes | map(select(.[0] == "attaching")) | length) } )'
echo "Volume Attachments:"
kubectl get csinode -o custom-columns="NAME:metadata.name,LIM:spec.drivers[].allocatable.count"
@AndreySemechkov
AndreySemechkov / resize_storage.sh
Last active March 4, 2021 12:53
Resize storage volumes available on an EC2
# commands to resize volumes, for example useful to utilize more storage after resizing an attached EBS manually
# Expand the PV on /dev/sda1 after enlarging the partition with fdisk:
pvresize /dev/sda1
# Extends the size of the logical volume "vg01/lvol10" by 1GiB
# on physical volume /dev/sda1. This is only possible if /dev/sda1 is a member of volume group vg01 and there are enough free physical extents in it:
lvextend -L +1024 /dev/vg01/lvol10 /dev/sda1