<p>We are using Azure and I'm creating a Elasticsearch instance through the following snippet with terraform on a managed AKS cluster:</p>
<pre><code>resource &quot;helm_release&quot; &quot;elasticsearch&quot; {
  name       = &quot;elasticsearch&quot;
  repository = &quot;https://helm.elastic.co&quot;
  chart      = &quot;elasticsearch&quot;
  version    = &quot;7.12.1&quot;
  timeout    = 900

  set {
    name  = &quot;volumeClaimTemplate.storageClassName&quot;
    value = &quot;elasticsearch-ssd&quot;
  }

  set {
    name  = &quot;volumeClaimTemplate.resources.requests.storage&quot;
    value = &quot;5Gi&quot;
  }

  set {
    name  = &quot;imageTag&quot;
    value = &quot;7.12.1&quot;
  }

  ...
}
</code></pre>
<p>So far no problem. Elasticsearch spins up and is ready to use. Everything is in a virtual net. So the nodes of Elasticsearch get attributed a Cluster IP.</p>
<p>Now, to deploy something on my Kubernetes Cluster that actually uses Elasticsearch, I need to pass it the cluster IP of the Elasticsearch.</p>
<p>Does anybody know a way to retrieve the Cluster IP in an automated way? So that I can pass it to the following terraform modules in my configuration? I think I scanned all the outputs of the helm release, but I'm unable to find the cluster IP...</p>
<p>In the example below, it would be the &quot;10.0.169.174&quot;:</p>
<pre><code>ppaulis@ppaulis-sb3:~/PhpstormProjects/baywa/infra/terraform-final/5_tms-api$ kubectl get services -o wide
NAME                            TYPE           CLUSTER-IP     EXTERNAL-IP    PORT(S)             AGE   SELECTOR
elasticsearch-master            ClusterIP      10.0.169.174   &lt;none&gt;         9200/TCP,9300/TCP   25h   app=elasticsearch-master,chart=elasticsearch,release=tms-dv-elasticsearch
elasticsearch-master-headless   ClusterIP      None           &lt;none&gt;         9200/TCP,9300/TCP   25h   app=elasticsearch-master
kubernetes                      ClusterIP      10.0.0.1       &lt;none&gt;         443/TCP             28h   &lt;none&gt;
</code></pre>
<p>Any help is appreciated!
Thanks,
Pascal</p>

Pascal Paulis
<p>First of all it's a bad practice to rely on Service IP address instead of DNS name.  If you're trying to reach ES outside of Kubernetes then you might want to automatically create DNS record for it using <a href="https://github.com/kubernetes-sigs/external-dns" rel="nofollow noreferrer">external-dns</a>. I think this is the best way.</p>
<p>However, nothing stops you from adjusting ES Helm chart to your needs. Just go ahead and modify the YAML here: <a href="https://github.com/elastic/helm-charts/blob/master/elasticsearch/templates/service.yaml" rel="nofollow noreferrer">https://github.com/elastic/helm-charts/blob/master/elasticsearch/templates/service.yaml</a></p>
