<p>I have an application.property value which reads like :</p>
<pre><code>spring.datasource.url=jdbc:mysql://&lt;clusterIP&gt;:3306/test
spring.datasource.username=root
spring.datasource.password=test123
</code></pre>
<p>where ClusterIP is generated when I create the ClusterIP using the below configuration :</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: mysql-cluster-ip-service
  labels:
    app: mysql-cluster-ip-service
spec:
  type: ClusterIP
  selector:
    app: mysql
  ports:
  - port: 3306
    targetPort: 3306
</code></pre>
<p>Assuming I get a ClusterIP <strong>10.100.205.156</strong> can I pass the value jdbc:mysql://&lt;<strong>10.100.205.156</strong>&gt;:3306/test dynamically in someway to the deployment yml file before I create the deployment and run mysql deployment in kubernetes.</p>
<p>I am a newbie to kubernetes, please suggest some ideas to achieve this. Thanks in advance</p>

Vikram
<p>Well, you can always replace <code>&lt;clusterIP&gt;</code> with DNS name of your service <code>mysql-cluster-ip-service</code>.</p>
<pre><code>spring.datasource.url=jdbc:mysql://mysql-cluster-ip-service:3306/test
</code></pre>
<p>and let the Kubernetes DNS service resolve the name to the actual IP address. Dealing with IP addresses directly is probably not the best idea.</p>
