Migrate from DaemonSet to Operator
This page describes how to migrate your Portworx cluster from a DaemonSet installation to a Portworx Operator installation.
Prerequisites
To migrate, you must meet the following prerequisites:
- Kubernetes version 1.16 or newer
- Portworx installed with one DaemonSet; the scenario of two or more DaemonSet installations on one Kubernetes cluster is not supported
Migrate to Operator
Install Portworx Operator
Install the Portworx Operator version 1.9.0 or newer using one of the following methods:
Install by spec generator
To install using the spec generator, run the following commands:
curl -o operator.yaml https://install.portworx.com/?comp=pxoperator
kubectl apply -f operator.yaml
Wait for the StorageCluster to be created
If you have Portworx DaemonSet installed, the Operator will automatically detect that on startup. The Operator will then create an equivalent StorageCluster object.
Add cloud provider annotation to StorageCluster
Run the appropriate command for your cloud provider from the following list:
-
Pivotal Kubernetes Service (PKS)
kubectl -n kube-system annotate storagecluster --all portworx.io/is-pks="true"
-
IBM Cloud Kubernetes Service (IKS)
kubectl -n kube-system annotate storagecluster --all portworx.io/is-iks="true"
-
Google Kubernetes Engine (GKE)
kubectl -n kube-system annotate storagecluster --all portworx.io/is-gke="true"
-
Azure Kubernetes Service (AKS)
kubectl -n kube-system annotate storagecluster --all portworx.io/is-aks="true"
-
Amazon Elastic Kubernetes Service (EKS)
kubectl -n kube-system annotate storagecluster --all portworx.io/is-eks="true"
-
OpenShift platform
kubectl -n kube-system annotate storagecluster --all portworx.io/is-openshift="true"
Perform a dry run (optional)
Portworx by Pure Storage recommends running a dry run and reviewing the specs:
-
Find the Portworx Operator pod:
kubectl -n kube-system get pods -l name=portworx-operator
-
Execute the dry run tool in the Portworx Operator container:
kubectl -n kube-system exec -it <portworx-operator-pod> -- /dryrun
If the dry run is successful, the end of the output will say Operator migration dry-run finished successfully
.
To review the specs that the Operator will deploy after migration, especially if you have any custom changes to your DaemonSet deployment, run the following commands:
-
List all of the specs that the Operator will deploy after migration:
kubectl -n kube-system exec -it <portworx-operator-pod> -- ls /tmp/portworxSpecs
-
Preview the Portworx pod spec after migration:
kubectl -n kube-system exec -it <portworx-operator-pod> -- cat /tmp/portworxSpecs/Pod.portworx.yaml
Migration using OnDelete update strategy (optional)
If you are not using OnDelete
for your StorageCluster update strategy, proceed to the next step.
If the StorageCluster update strategy is OnDelete
(which means that DaemonSet has the OnDelete
update strategy or the StorageCluster was updated manually to include this strategy), you will need to manually migrate Portworx pods on the nodes. Migration will be blocked until all Portworx nodes are migrated. After all Portworx nodes are migrated, Operator will migrate the components automatically.
-
Run the following command to approve the migration:
kubectl -n kube-system annotate storagecluster --all --overwrite portworx.io/migration-approved='true'
-
Change the migration label to
Starting
on the KVDB nodes:kubectl label node <kvdb-node> portworx.io/daemonset-migration=Starting --overwrite
A KVDB node should be migrated one at a time, and wait until all KVDB nodes are migrated and pods are created:
-
Change the migration label to
Starting
on nodes to trigger migration on a Portworx node:kubectl label node <portworx-node> portworx.io/daemonset-migration=Starting --overwrite
Operator starts migrating the labeled nodes at once.
- If the update strategy is changed from
OnDelete
toRollingUpdate
during the nodes migration, the Operator will pick up the Portworx node in progress and continue the migration process automatically. - If the update strategy is changed from
RollingUpdate
toOnDelete
during the nodes migration, the procedure will be blocked after the current node migration is done, then the procedure will wait for manual approval.
You can skip the next section and proceed to this section to verify the status of your migration.
Approve the migration
To approve the migration, run the following command:
kubectl -n kube-system annotate storagecluster --all --overwrite portworx.io/migration-approved='true'