<p>I have a project based on a massive ingestion of Kafka messages, those messages interact with a MySQL database.</p>
<p>I want to know the best way to update MySQL tables using scripts (.sql). I'm thinking about deploy them during the application startup, then Kafka will save the messages until the application is started and send them to the application with all database modifications finished.
Any idea/example? I suppose kubernetes orchestration can be a problem to achieve this!</p>

sergiopf
<p>One theoretical possibility here sergio</p>
<ul>
<li><p>Attach the script to a PVC to be used in MySQL and add the scripts to
run</p>
</li>
<li><p>Use a post start hook and run the script mounted
(<a href="https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/" rel="nofollow noreferrer">Post start hook</a>)</p>
</li>
<li><p>For the kafka container have a
<a href="https://kubernetes.io/docs/concepts/workloads/pods/init-containers/" rel="nofollow noreferrer">init-container</a>. This checks for existance of a row or some
check if all is well with the MySQL pod</p>
</li>
<li><p>Bring up the kafka pod</p>
</li>
</ul>
<p>(was over limit for a comment , posted as an answer)</p>
