|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// installing-{prod-id-short}-on-amazon-elastic-kubernetes-service |
| 4 | + |
| 5 | +[id="configuring-DNS-on-amazon-elastic-kubernetes-service"] |
| 6 | += Configuring DNS on {eks-short} |
| 7 | + |
| 8 | +Follow these instructions to configure DNS on {eks-short}. |
| 9 | + |
| 10 | +.Prerequisites |
| 11 | + |
| 12 | +* A registered domain. See: link:https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-register.html[Registering a new domain on {eks-short}]. |
| 13 | + |
| 14 | +.Procedure |
| 15 | + |
| 16 | +. Define the registered domain name: |
| 17 | ++ |
| 18 | +[source,subs="attributes+"] |
| 19 | +---- |
| 20 | +CHE_DOMAIN_NAME=eclipse-che-eks-clould.click |
| 21 | +---- |
| 22 | + |
| 23 | +. Define domain name for Keycloak OIDC provider: |
| 24 | ++ |
| 25 | +[source,subs="attributes+"] |
| 26 | +---- |
| 27 | +KEYCLOAK_DOMAIN_NAME=keycloak.$CHE_DOMAIN_NAME |
| 28 | +---- |
| 29 | + |
| 30 | +. Find out the hosted zone ID for the domain: |
| 31 | ++ |
| 32 | +[source,subs="attributes+"] |
| 33 | +---- |
| 34 | +HOSTED_ZONE_ID=$(aws route53 list-hosted-zones-by-name --dns-name $CHE_DOMAIN_NAME --query "HostedZones[0].Id" --output text) |
| 35 | +---- |
| 36 | + |
| 37 | +. Find out the Canonical Hosted Zone ID for the load balancer: |
| 38 | ++ |
| 39 | +[source,subs="attributes+"] |
| 40 | +---- |
| 41 | +CANONICAL_HOSTED_ZONE_ID=$(aws elbv2 describe-load-balancers --query "LoadBalancers[0].CanonicalHostedZoneId" --output text) |
| 42 | +---- |
| 43 | + |
| 44 | +. Find out the DNS name for the load balancer: |
| 45 | ++ |
| 46 | +[source,subs="attributes+"] |
| 47 | +---- |
| 48 | +DNS_NAME=$({orch-cli} get service -n ingress-nginx ingress-nginx-controller -o=jsonpath='{.status.loadBalancer.ingress[0].hostname}') |
| 49 | +---- |
| 50 | + |
| 51 | +. Create a DNS record set: |
| 52 | ++ |
| 53 | +[source,subs="attributes+"] |
| 54 | +---- |
| 55 | +aws route53 change-resource-record-sets \ |
| 56 | + --hosted-zone-id $HOSTED_ZONE_ID \ |
| 57 | + --change-batch ' |
| 58 | + { |
| 59 | + "Comment": "Ceating a record set", |
| 60 | + "Changes": [{ |
| 61 | + "Action" : "CREATE", |
| 62 | + "ResourceRecordSet" : { |
| 63 | + "Name" : "'"$CHE_DOMAIN_NAME"'", |
| 64 | + "Type" : "A", |
| 65 | + "AliasTarget" : { |
| 66 | + "HostedZoneId" : "'"$CANONICAL_HOSTED_ZONE_ID"'", |
| 67 | + "DNSName" : "'"$DNS_NAME"'", |
| 68 | + "EvaluateTargetHealth" : false |
| 69 | + } |
| 70 | + } |
| 71 | + }] |
| 72 | + } |
| 73 | + ' |
| 74 | +---- |
| 75 | + |
| 76 | +. Verify that you can access {prod-short} domain externally: |
| 77 | ++ |
| 78 | +[source,subs="attributes+"] |
| 79 | +---- |
| 80 | +until curl $CHE_DOMAIN_NAME; do sleep 5s; done |
| 81 | +---- |
| 82 | + |
| 83 | +. Create a DNS record set: |
| 84 | ++ |
| 85 | +[source,subs="attributes+"] |
| 86 | +---- |
| 87 | +aws route53 change-resource-record-sets \ |
| 88 | + --hosted-zone-id $HOSTED_ZONE_ID \ |
| 89 | + --change-batch ' |
| 90 | + { |
| 91 | + "Comment": "Ceating a record set", |
| 92 | + "Changes": [{ |
| 93 | + "Action" : "CREATE", |
| 94 | + "ResourceRecordSet" : { |
| 95 | + "Name" : "'"$KEYCLOAK_DOMAIN_NAME"'", |
| 96 | + "Type" : "A", |
| 97 | + "AliasTarget" : { |
| 98 | + "HostedZoneId" : "'"$CANONICAL_HOSTED_ZONE_ID"'", |
| 99 | + "DNSName" : "'"$DNS_NAME"'", |
| 100 | + "EvaluateTargetHealth" : false |
| 101 | + } |
| 102 | + } |
| 103 | + }] |
| 104 | + } |
| 105 | + ' |
| 106 | +---- |
| 107 | + |
| 108 | +. Verify that you can access the Keycloak domain externally: |
| 109 | ++ |
| 110 | +[source,subs="attributes+"] |
| 111 | +---- |
| 112 | +until curl $KEYCLOAK_DOMAIN_NAME; do sleep 5s; done |
| 113 | +---- |
0 commit comments