<p>Currently I am doing deployment and creating a service with type loadbalancer. I can access the POD via the created ELB. Then using route 53 I am attaching the ELB with k8-test.abc.com using alias. Below is the snippet.</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: %APP_FULL_NAME%-service-lb-http
  labels:
    appname: %APP_FULL_NAME%
    stage: %APP_ENV%
    component: app-kube-aws-elb
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabled: "True"
    service.beta.kubernetes.io/aws-load-balancer-ssl-cert: arn:aws:acm:us-east-1:XXXXXXXXXXXXX:certificate/XXXXXXXXXXXXXXX
    service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http

spec:
  type: LoadBalancer
  ports:
  - name: http
    port: 443
    targetPort: 8080
    protocol: TCP
  selector:
    appname: %APP_FULL_NAME%
    stage: %APP_ENV%
</code></pre>

<p>But I was wondering is there any way by which I can do some changes on deployment and the ELB which will be created, automatically get attached to the k8-test.abc.com while creating.  </p>

<p>There is an Incubator project (read: you may use it, but don't complain if it breaks) called <a href="https://github.com/kubernetes-incubator/external-dns" rel="nofollow noreferrer">external-dns</a>. I haven't used it myself, but it looks like it may do what you ask for. Among other DNS providers, it also offers support for Route53.</p>

<p>After set-up (here's <a href="https://github.com/kubernetes-incubator/external-dns/blob/master/docs/tutorials/aws.md" rel="nofollow noreferrer">the documentation on how to set-up <em>external-dns</em> on AWS</a>), you can define a DNS name for a Service using the <code>external-dns.alpha.kubernetes.io/hostname</code> annotation:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: %APP_FULL_NAME%-service-lb-http
  labels:
    appname: %APP_FULL_NAME%
    stage: %APP_ENV%
    component: app-kube-aws-elb
  annotations:
    external-dns.alpha.kubernetes.io/hostname: k8-test.abc.com
    service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabled: "True"
    service.beta.kubernetes.io/aws-load-balancer-ssl-cert: arn:aws:acm:us-east-1:XXXXXXXXXXXXX:certificate/XXXXXXXXXXXXXXX
    service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http
spec:
  type: LoadBalancer
  ports:
  - name: http
    port: 443
    targetPort: 8080
    protocol: TCP
  selector:
    appname: %APP_FULL_NAME%
    stage: %APP_ENV%
</code></pre>

<p>This will automatically create the respective DNS records that will alias the DNS name <code>k8-test-abc.com</code> to your ELB.</p>
