Created
August 10, 2019 00:39
-
-
Save shcallaway/a66671a56ceda81d5916a88481c002c8 to your computer and use it in GitHub Desktop.
Check for any public Kubernetes LoadBalancers on AWS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Kubernetes Context: $1" | |
echo "-- LOADBALANCERS --" | |
LOADBALANCERS=`kubectl get svc --context $1 | grep LoadBalancer | awk '{print $1}'` | |
for LOADBALANCER in $LOADBALANCERS; do | |
echo $LOADBALANCER | |
PRIVATE=`kubectl get svc --context $1 $LOADBALANCER -o jsonpath='{.metadata.annotations.service\.beta\.kubernetes\.io\/aws-load-balancer-internal}'` | |
if [ -z "$PRIVATE" ]; then | |
echo "NOT PRIVATE!" | |
fi | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment