<p>Say I have the following YAML representing a service:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-ssl-cert: arn:aws:acm:us-west-2:91371:certificate/0a389f-4086-4db6-9106-b587c90a3
    service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http
    service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "443"
  labels:
    app: main-api-prod
  name: main-api-prod
spec:
  type: LoadBalancer
  ports:
    - name: http
      protocol: TCP
      port: 80
      targetPort: 80
    - name: https
      protocol: TCP
      port: 443
      targetPort: 80
  selector:
    app: main-api-prod
</code></pre>

<p>after I run:</p>

<pre><code>kubectl apply -f &lt;file&gt;
</code></pre>

<p>I run:</p>

<pre><code>kbc get svc -o json | grep hostname
</code></pre>

<p>and we see:</p>

<blockquote>
  <p>"hostname":
  "a392f200796b8b0279bdd390c-228227293.us-west-2.elb.amazonaws.com"</p>
</blockquote>

<p>my question is - is there a way to tell <code>kubectl</code> to use my own id in the hostname? In other words, I would like to tell it to use "abc" instead of  "a392..", so it would be:</p>

<pre><code>"abc-228227293.us-west-2.elb.amazonaws.com"
</code></pre>

<p>As an aside, if anyone knows what "228227293" represents, please lmk, I know that it is not our AWS accountid, that's for sure.</p>

Alexander Mills
<p>When you create a service of type "load balancer", a new load balancer is created by your cloud provider (here aws). Load Balancer naming is of the responsibility of the cloud provider. I don't think you can tell amazon how to generate the load balancer name. And it may depends of the load balancer type - alb, internal alb, nlb, ....</p>

<p>But you can use "external-dns" (<a href="https://github.com/kubernetes-incubator/external-dns" rel="nofollow noreferrer">https://github.com/kubernetes-incubator/external-dns</a>). When configured for a dns providers - for exemple aws route53 - it can automatically creates dns aliases for your load balancer. But you won't be able to create name in amazonws.com domain ...</p>
