Skip to content

Instantly share code, notes, and snippets.

@nmofonseca
nmofonseca / k8s_resources.sh
Last active April 25, 2024 10:42
Script to get resources used and available in a K8s cluster
#!/bin/bash
# Variables to keep track of the total available CPU and memory
total_available_cpu=0
total_available_memory=0
for node in $(kubectl get nodes -o jsonpath='{.items[*].metadata.name}'); do
echo "Node: $node"
# Get the current usage