Skip to content

Instantly share code, notes, and snippets.

@GoaMind
Last active July 26, 2022 10:14
Show Gist options
  • Save GoaMind/c7bb167d33a8f5f14d7e809ad2a6e467 to your computer and use it in GitHub Desktop.
Save GoaMind/c7bb167d33a8f5f14d7e809ad2a6e467 to your computer and use it in GitHub Desktop.
# PODS
# Get all problematic pods from all namespaces
kubectl get pods -A | grep -v "Running\|Completed"
# Get most PODs with most reservation
kubectl get po -o=custom-columns='NAME:.metadata.name,CONTAINERS:.spec.containers[*].name,REQUEST:.spec.containers[*].resources.requests.cpu,AGE:.metadata.creationTimestamp' --sort-by='.spec.containers[0].resources.requests.cpu' -A
# DEPLOYMENTS
# Scale all deployments to 1
kubectl scale --replicas=1 `kubectl get deploy -o name`
# NODES
# Get nodes sorted with by creation time (oldest on top)
kubectl get get nodes --sort-by=.metadata.creationTimestamp
# Get nodes resource
kubectl get nodes -o=custom-columns='NAME:.metadata.name,CPU ALLOC:.status.allocatable.cpu,CPU CAPACITY:.status.capacity.cpu'
# HELM
# Uninstall all releases
helm uninstall `helm list --short`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment