Skip to content

Instantly share code, notes, and snippets.

@robertstarmer
Created July 22, 2019 03:39
Show Gist options
  • Save robertstarmer/bfa649933bb9f8ce1b489c1d6e903975 to your computer and use it in GitHub Desktop.
Save robertstarmer/bfa649933bb9f8ce1b489c1d6e903975 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ $# != 1 ] ; then
echo 'what is the cluster name'
echo $0 " {cluster_name}"
exit 1
fi
echo "private ENI IPs for EKS $1"
IP=`aws ec2 describe-network-interfaces --filter "Name=description,Values=*${1}*" --query "NetworkInterfaces[0].PrivateIpAddress" | tr -d '"'`
aws eks update-kubeconfig --name ${1} --kubeconfig /tmp/${1}.kubeconfig
sed -i "s,https://.*$,https://${IP}," /tmp/${1}.kubeconfig
mv /tmp/${1}.kubeconfig ~/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment