Created
December 12, 2019 09:07
-
-
Save ams0/98a77504add6b8869e706aeae2e9f5fd to your computer and use it in GitHub Desktop.
A simple script to extract the private DNS IP for an AKS private cluster
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 | |
#AKS private clusters | |
#Setup VPN gw with OpenVPN | |
rg=k8s | |
clustername=private | |
az aks get-credentials -g $rg -n $clustername | |
fqdn=`az aks show -g $rg -n private --query privateFqdn -o tsv 2> /dev/null` | |
record=`az aks show -g $rg -n private --query privateFqdn -o tsv 2> /dev/null | sed 's/\..*$//'` | |
rg=`az aks show -g $rg -n private --query nodeResourceGroup -o tsv 2> /dev/null` | |
zone=`az aks show -g $rg -n private --query privateFqdn -o tsv 2> /dev/null | sed 's/^[^.]*.//g'` | |
address=`az network private-dns record-set a show -g $rg -z $zone -n $record -o tsv --query aRecords[0].ipv4Address` | |
#sed -i "s/$fqdn/$address/g" ~/.kube/config | |
echo "$address $fqdn" >> /etc/hostsa |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment