<p>In Kubernetes, What is the easy way to convert a running pod manifest into a Deployment with x number of replicas?</p>
<p>i tried by fetching manifest</p>
<pre><code>k get po xyz -o yaml&gt;po1.yaml
</code></pre>
<p>then editing the yaml and matching with a deployment manifest, but seems it was not easy. I kept on getting errors, while converting.</p>

user190245
<p>You can't do dit automatically, they is a few fields that are computed on the submit of the pod.</p>
<p>But you can play a little with <a href="https://github.com/kislyuk/yq" rel="nofollow noreferrer"><code>yq</code></a> to extract the spec of the pod:</p>
<pre><code>k get pod/xyz -o yaml | yq .spec -y &gt; pod-spec.yml
</code></pre>
<p>Then you just have to add it to a deployment:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: deployment
  name: deployment
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: deployment
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: deployment
    spec: &lt;here&gt;
</code></pre>
<p>Don't forget to remove from the pod spec:</p>
<ul>
<li><code>volumeMounts</code> and <code>volume</code> of the service account</li>
<li><code>nodeName</code></li>
</ul>
<p>There is also a lot of default fields that you can remove.</p>
