Remember to set AWS_PROFILE and KUBECONFIG.
- You should set namespace to 'devstats' first:
./switch_namespace.sh devstats. - First you need
ngingx-ingress:helm install stable/nginx-ingress --name nginx-ingress. - Note External-IP field from
kubectl --namespace devstats get services -o wide -w nginx-ingress-controllerwhen ready (zzz.us-east-1.elb.amazonaws.com).
- Register a domain in AWS via:
aws route53domains register-domain --generate-cli-skeleton > domain/devstats.graphql.org.json. Fill that JSONvim domain/devstats.graphql.org.json. - Register domain via:
cat domain/devstats.graphql.org.json | jq -cM . | AWS_PROFILE=... xargs -d '\n' aws route53domains register-domain --cli-input-json - Use
aws route53 list-hosted-zonesto list hosted zones. Get the ZoneID (xxx). - Use
aws route53 list-resource-record-sets --hosted-zone-id "/hostedzone/xxx"to list hosted zone records. - To add mapping to our
ingress-nginx:aws route53 change-resource-record-sets --hosted-zone-id xxx --change-batch '{"Changes":[{"Action":"CREATE","ResourceRecordSet":{"Name":"*.devstats.graphql.org.","Type":"CNAME","TTL":300,"ResourceRecords":[{"Value":"zzz.us-east-1.elb.amazonaws.com"}]}}]}'. - You will need a Zone ID (yyy) for the target ELB, find it via:
aws elb describe-load-balancers | grep Zone. - To add mapping for the domain itself (not subdomains):
aws route53 change-resource-record-sets --hosted-zone-id xxx --change-batch '{"Changes":[{"Action":"CREATE","ResourceRecordSet":{"Name":"devstats.graphql.org.","Type":"A","AliasTarget":{"HostedZoneId":"yyy","DNSName":"dualstack.zzz.us-east-1.elb.amazonaws.com.","EvaluateTargetHealth":false}}}]}'
- Update
devstats.graphql.orgdomain setup, make sure thatdevstats.graphql.organd wildcard*.devstats.graphql.orgpoint tozzz.us-east-1.elb.amazonaws.comusing CNAME record(s).
- Now proceed to
cert-managerinstallation inSSL.md.
Other useful command (not necesarily needed in this setup):
- Manually create AWS hosted zone:
aws route53 create-hosted-zone --name "devstats.graphql.org" --caller-reference "devstats.graphql.org-$(date +%s)". Note its ID. - To list DNS servers assigned to this new hosted zone:
aws route53 list-resource-record-sets --output json --hosted-zone-id "/hostedzone/xxx" --query "ResourceRecordSets[?Type == 'NS']" | jq -r '.[0].ResourceRecords[].Value'. - To check if DNS is working:
dig +short @first-dns-server. graphql.devstats.graphql.org. you can useanything.devstats.graphql.orgbecause this is a wildcard domain. Alsodig +short @second-dns-server. devstats.graphql.orgto check main domain. - To actually test them:
links https://prometheus.devstats.graphql.org. - To delete wildcard record:
aws route53 change-resource-record-sets --hosted-zone-id xxx --change-batch '{"Changes": [{"Action": "DELETE","ResourceRecordSet": {"Name": "*","Type": "CNAME","TTL": 300,"ResourceRecords": [{ "Value": "zzz.us-east-1.elb.amazonaws.com"}]}}]}'. - To delete main record:
aws route53 change-resource-record-sets --hosted-zone-id xxx --change-batch '{"Changes":[{"Action":"DELETE","ResourceRecordSet":{"Name":"devstats.graphql.org.","Type":"A","AliasTarget":{"HostedZoneId":"yyy","DNSName":"dualstack.zzz.us-east-1.elb.amazonaws.com.","EvaluateTargetHealth":false}}}]}' - To delete hosted zone:
AWS_PROFILE=cncf-west-2 aws route53 delete-hosted-zone --id "/hostedzone/xxx".