<p>Working on TDengine (an iot time-series database) cluster for Kubernetes.</p>
<ul>
<li>Use statefulset for ordinary pods.</li>
<li>Use helm to deploy.</li>
</ul>
<p>Now I want to place pod to a specific nodes, such as pod-0 to node-0, pod-1 to node-1, and keep it even after pod restart or re-created.</p>
<p>What's the best way to do so?</p>

zitsen
<p>It's not a good approach</p>
<p><strong>but if you still insist</strong></p>
<p>which is not recommended you can use <code>labels</code> to mark your nodes and then using node selector (dynamically) for example mark each node with pod name, it will be sequence since its stateful ser so you can know the pod names</p>
<pre class="lang-yaml prettyprint-override"><code>
# Mark your desired nodes
kubectl label node xxxxxxxx deployedName=pod-0


# for example assume that you have marked your nodes with pod-0
# In your StatefulSet:
node selector:
    deployedName: pod-0
</code></pre>
<p>This is just an example.</p>
<p>More advanced options will be to use</p>
<pre><code> affinity:
    nodeAffinity:
</code></pre>
<p>and there are more option ofcourse</p>
