<p>The issue is that I would like to persistent one status file(status generated by the service), not the directory, of some service in case the status lost when service restart, how to solve?</p>

zulv
<p>If it's just a status file, you should be able to write it into a config map. See <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#add-configmap-data-to-a-volume" rel="nofollow noreferrer">Add ConfigMap data to a Volume</a>. If in volumes you have</p>

<pre><code>volumes:
  - name: status
    configMap:
      name: status
      defaultMode: 420
      optional: true
</code></pre>

<p>and in volumeMounts</p>

<pre><code>volumeMounts:
  - name: status
    mountPath: /var/service/status
</code></pre>

<p>then you should be able to write in it. See also how kube-dns does it with the <code>kube-dns-config</code> mount from <code>kube-dns</code> config-map.</p>
