Can we Store the Application Service - Load balancer URL as a Variable before deploying Application t

I am Deploying applications on Kubernetes (EKS Cluster) as type: LoadBalancer. Below is a Sample Service

        kind: Service
    apiVersion: v1
    metadata:
      name: kafka-manager
      namespace: kafka
    spec:
      selector:
        app: kafka-manager
      type: LoadBalancer
      ports:
      - port: 9000
        protocol: TCP
        targetPort: 9000

Can we Store the Loadbalancer url for the services in the form of Variables ?

I do not want to define the Load balancer URL in the deployment file manually as I am trying to create automated pipelines , the app deployment file should take the URL itself once after successfully creating the service .

Kindly let me know how we can do that

Thanks in advance

Short answer: no. Environment variables are a very clunky API and we’re not adding more. There’s no API link between Deployment and Service, so no way to express this.

You could run a sidecar which does a kubectl get and writes to a file in a shared emptyDir volume, probably?

Expanding on the sidecar, the sidecar could just be built to update the DNS to point to the service IP.

Could also just manage your Kubernetes infrastructure with Terraform. It can manage your DNS in many different clouds and manage Kubernetes resources and reference between them.