Created
August 21, 2020 03:26
-
-
Save mikesparr/0c5b9b17f5a62a0fcdf6981cf4d73a54 to your computer and use it in GitHub Desktop.
Create managed zone in Google Cloud DNS
This file contains 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
source .env | |
# export PROJECT_ID=<from .env> | |
# export AUTH_NETWORK=<from .env> | |
export DNS_ZONE_NAME=msparr-com | |
# create dns zone (you will need to point nameservers to Cloud DNS) | |
gcloud beta dns --project=$PROJECT_ID managed-zones create $DNS_ZONE_NAME \ | |
--description= \ | |
--dns-name=msparr.com. | |
# fetch the public IP address of the kong-proxy TCP lb | |
export KONG_PROXY_IP=$(kubectl get svc/kong-proxy -n kong -o jsonpath='{.status.loadBalancer.ingress[0].ip}') | |
echo "Kong proxy IP is ${KONG_PROXY_IP}" | |
# create dns record set for Kong proxy (A record) | |
gcloud dns --project=$PROJECT_ID record-sets transaction start --zone=$DNS_ZONE_NAME | |
gcloud dns --project=$PROJECT_ID record-sets transaction add $KONG_PROXY_IP \ | |
--name=kong-proxy.msparr.com. \ | |
--ttl=300 \ | |
--type=A \ | |
--zone=$DNS_ZONE_NAME | |
gcloud dns --project=$PROJECT_ID record-sets transaction execute --zone=$DNS_ZONE_NAME | |
# confirm setup as desired | |
gcloud dns managed-zones list | |
gcloud dns record-sets list --zone=$DNS_ZONE_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment