<p>Playing around with Kong in DB-less mode in a docker container. Trying to figure out if we can use it as a gateway for the company I work for. I currently mount a local folder onto my docker container and pass the path to the <code>kong.yaml</code> file to kong when it starts. When I need to update the configuration, I do a <code>POST</code> to the <code>/config</code> endpoint.</p>
<p>All good so far.</p>
<p>However, my concern is, how I am supposed to handle a Kong restart? The configuration I have will be generated in a separate micro-service from a PostGre database.</p>
<p>Kong will be running as an Ingress controller in our Kubernetes cluster. One thing I could do is  expose an endpoint that generates a <code>kong.yml</code> config file based on my data in PostGre. Kong could hit that on start up. I think I can make it a part of its start command.</p>
<p>Anyway, this seems like perhaps a bit of a hack. I was wondering, are there are any best practices around this. I'm sure other people have faced this problem before :-)</p>
<p>Thanks!</p>

<h2>Answer</h2>
<p>Configuring Kong on Kubernetes is done through Kubernetes native resources (e.g. Ingress) and <a href="https://github.com/Kong/kubernetes-ingress-controller/blob/master/docs/references/custom-resources.md" rel="nofollow noreferrer">Kong Custom Resources</a> (e.g. KongConsumer, KongPlugin, KongIngress).</p>
<p>The Kong Ingress Controller will make all necessary changes based on changes to those resources through the Kubernetes API Server.</p>
<h2>Additional Info</h2>
<p>I highly recommend going through these <a href="https://github.com/Kong/kubernetes-ingress-controller/tree/master/docs/guides" rel="nofollow noreferrer">guides</a>. They are comprehensive and highly educational.</p>
<p>Make sure to keep an eye on the logs coming out of the Kong Ingress Controller pod because this will tell you whether it has successfully reconciled changes based on those resources or not.</p>
<p>Also feel free to take a look at this <a href="https://github.com/projectmin/kongtroller" rel="nofollow noreferrer">project</a> where we manage Kong CRs through an on-cluster REST API Microservice.</p>
