<p>There are cases when you want to restart a specific container instead of deleting the pod and letting Kubernetes recreate it.</p>

<p>i am having one pod running apache container. i did editing in apache config file. for SSL certificate virtual host port changes etc.</p>

<p>now i want to restart apache2 service but without recreating pod.</p>

<p>i tried inside pod with </p>

<pre><code>service apache2 restart
</code></pre>

<p>but it also recreate pod and configuration also change again.</p>

Harsh Manvar
<p>This is not how it supposed to work.</p>

<p>You should not change anything inside the <code>POD</code>.
If your <code>POD</code> dies or crushes, Kubernetes should just start a new one and everything should work.
Also keep in mind that you cannot scale the <code>POD</code> that had configuration altered.</p>

<p>Please check the Kubernetes docs <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/" rel="nofollow noreferrer">Configure a Pod to Use a ConfigMap</a></p>

<p>You can use <code>ConfigMap</code> to create configuration file.</p>

<blockquote>
  <p>ConfigMaps allow you to decouple configuration artifacts from image content to keep containerized applications portable. This page provides a series of usage examples demonstrating how to create ConfigMaps and configure Pods using data stored in ConfigMaps.</p>
</blockquote>

<p><code>ConfigMap</code> can be created and read a content of a file :</p>

<p><code>$ kubectl create configmap config_data --from-file=config_data.txt</code></p>

<p>or it can be declared in .yml</p>

<pre><code>config_map:
  data: 
    db_name=colors_db
    table_name=purple
  name: config_data
  version: v1
</code></pre>

<p>Also this might be done by creating a <code>secret</code>
or <code>secret</code> can be declared:</p>

<pre><code>secret:
  data:
    username: my-username
    password: my-password
  name: secret_data
  version: v1
</code></pre>

<p>I recommend reading <a href="https://medium.com/@olegsmetanin/kubernetes-receipt-reverse-proxy-to-your-github-page-using-configmap-1b81ec31cbd1" rel="nofollow noreferrer">Kubernetes recipe: store nginx config with ConfigMap and reverse-proxy requests from your domain to your Github page</a>.</p>

<p>There are also other options like mounting path with needed configuration on new <code>POD</code>.
I advice you to check <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/" rel="nofollow noreferrer">Configure a Pod to Use a PersistentVolume for Storage</a></p>
