title: Convert Deployment to StatefulSet in Kubernetes
body: <p>I am trying to convert one Deployment to StatefulSet in Kubernetes. Below is my Deployment description .</p>
  
  <pre><code># Please edit the object below. Lines beginning with a '#' will be ignored,
  # and an empty file will abort the edit. If an error occurs while saving this file will be
  # reopened with the relevant failures.
  #
  apiVersion: apps/v1
  kind: Deployment
  metadata:
    annotations:
      deployment.kubernetes.io/revision: "4"
    creationTimestamp: "2020-04-02T07:43:32Z"
    generation: 6
    labels:
      run: jbpm-server-full
    name: jbpm-server-full
    namespace: dice-jbpm
    resourceVersion: "2689379"
    selfLink: /apis/apps/v1/namespaces/dice-jbpm/deployments/jbpm-server-full
    uid: 8aff5d46-533a-4178-b9b5-5015ff1cdd5d
  spec:
    progressDeadlineSeconds: 600
    replicas: 1
    revisionHistoryLimit: 10
    selector:
      matchLabels:
        run: jbpm-server-full
    strategy:
      rollingUpdate:
        maxSurge: 25%
        maxUnavailable: 25%
      type: RollingUpdate
    template:
      metadata:
        creationTimestamp: null
        labels:
          run: jbpm-server-full
      spec:
        containers:
        - image: jboss/jbpm-server-full:latest
          imagePullPolicy: Always
          name: jbpm-server-full
          ports:
          - containerPort: 8080
            protocol: TCP
          resources: {}
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          volumeMounts:
          - mountPath: /k8sdata/jbpmdata
            name: jbpm-pv-storage
        dnsPolicy: ClusterFirst
        restartPolicy: Always
        schedulerName: default-scheduler
        securityContext: {}
        terminationGracePeriodSeconds: 30
        volumes:
        - name: jbpm-pv-storage
          persistentVolumeClaim:
            claimName: jbpm-pv-claim
  status:
    availableReplicas: 1
    conditions:
    - lastTransitionTime: "2020-04-02T07:43:32Z"
      lastUpdateTime: "2020-04-09T12:35:19Z"
      message: ReplicaSet "jbpm-server-full-b48989789" has successfully progressed.
      reason: NewReplicaSetAvailable
      status: "True"
      type: Progressing
    - lastTransitionTime: "2020-04-09T12:37:05Z"
      lastUpdateTime: "2020-04-09T12:37:05Z"
      message: Deployment has minimum availability.
      reason: MinimumReplicasAvailable
      status: "True"
      type: Available
    observedGeneration: 6
    readyReplicas: 1
    replicas: 1
    updatedReplicas: 1
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>deployments.apps "jbpm-server-full" was not valid:
  * : Invalid value: "The edited file failed validation": 
  
  ValidationError(StatefulSet.spec): unknown field "progressDeadlineSeconds" in io.k8s.api.apps.v1.StatefulSetSpec, 
  
  ValidationError(StatefulSet.spec): 
  unknown field "strategy" in io.k8s.api.apps.v1.StatefulSetSpec, 
  
  ValidationError(StatefulSet.spec): missing required field "serviceName" in io.k8s.api.apps.v1.StatefulSetSpec, 
  
  ValidationError(StatefulSet.status): unknown field "availableReplicas" in io.k8s.api.apps.v1.StatefulSetStatus, 
  
  ValidationError(StatefulSet.status.conditions[0]): unknown field "lastUpdateTime" in io.k8s.api.apps.v1.StatefulSetCondition, 
  
  ValidationError(StatefulSet.status.conditions[1]): unknown field "lastUpdateTime" in io.k8s.api.apps.v1.StatefulSetCondition]
  </code></pre>
  
  <p>I have attached a persistent volume to this deployment , but i am losing the data whenever the pod is restarted. And now i am trying to convert this existing Deployment Type to statefulSet. I have followed several links , but in vain resulting in errors.</p>
  
  <p>Could you help me.</p>