<p>I'm <strong>looking</strong> for a <strong>bash script</strong> that could <strong>backup all</strong> the <strong>kubernetes</strong> in a <strong>yaml format</strong> or <strong>json</strong> it's good too:) 
I already backup the kubernetes conf files already. </p>

<pre><code>/etc/kubernetes
/etc/systemd/system/system/kubelet.service.d
</code></pre>

<p>etc... </p>

<p>Now I'm just looking to save the </p>

<p><strong>namespaces</strong></p>

<p><strong>deployment</strong></p>

<p>etc... </p>

<p>You can dump your entire cluster info into one file using:</p>

<pre><code>kubectl cluster-info dump &gt; cluster_dump.txt
</code></pre>

<p>The above command will dump all the yaml and container logs into one file</p>

<p>Or if you just want yaml files, you can write a script of some commands which includes</p>

<pre><code>kubectl get deployment -o yaml &gt; deployment.yaml
kubectl get statefulset -o yaml &gt; statefulset.yaml
kubectl get daemonset -o yaml &gt; daemonset.yaml
</code></pre>

<p>Then you have to keep the namespace also in mind while creating the script. This gives you fair idea what to do</p>
