<p>I have a mysql pod running in kubernetes and the service is exposed as ClusterIP. When I grep the SERVICE in kubernetes I get </p>

<pre><code>MYSQL_SERVICE_SERVICE_HOST=10.152.183.135
</code></pre>

<p>I am currently passing this as environment variable in the <code>deployment.yml</code> file of backend and accessing it is Python backend using <code>os.getenv()</code> function.</p>

<p>Can I directly call this host name in python as <code>mysql_host = "{}".format(MYSQL_SERVICE_SERVICE_HOST)</code> so that passing it as env variable is not required. Can anyone give me a helping hand? </p>

anju
<p>Assuming Python is also running in same Kubernetes cluster. You don't need to pass MySQL host name.  You should be able to reach MySQL service from Python pod using MySQL service name.</p>

<p>use below format</p>

<pre><code>&lt;mysql-service-name&gt;.&lt;namespace&gt;.svc.cluster.local
</code></pre>
