This tutorial is an example of how to use the Konveyor tool Crane to migrate an application (inventory) from the source Kubernetes cluster (src) to the destination cluster (dest).
Refer to the Crane Documentation for more detailed information.
Note: In addition to migrating with Crane, it is helpful to push the application to Git so it can be automatically deployed to any cluster in the future. This demo includes those steps.
> $ minikube profile list
> $ kubectl --context src get namespace
> $ kubectl --context src --namespace inventory get all
> $ kubectl --context src --namespace inventory get pvc
> $ curl http://…
> $ kubectx src
> $ kubectl get ns
Tip: Use the kubectx
and kubectl
get ns commands
to change the context to the destination and verify the migrating application does not exist.
> $crane export --namespace=inventory
> $ tree export
Note: These files cannot be imported into another cluster because of the existing IP addresses, timestamps, etc. which should not be pushed to Git. View this data using the
cat command
.
When the application is migrated, this information must be updated to the new cluster.
> $ crane transform list-plugins
Note: This example uses the Kubernetes plugin. Use the Crane Plugin Manager
list command
to view available plugins to install and translate the manifest into OpenShift for example.
> $ crane transform optionals
> $ crane transform
> $ tree transform
> $ cat [directory path]
> $ crane apply
> $ tree output
> $ crane apply -o
> $ kubectx dest
> $ kubectl --context dest create ns inventory \ namespace/inventory created
> $ kubectl --context src --namespace inventory get pvc
> $ crane transfer-pvc --source-context=src \ --pvc-name=postgres-pv-claim --destination-context=dest
Tip: Perform the migration while the application is running and then again during a maintenance window when the application has been shut down to only migrate over the delta between the migrations.
> $ ls
> $ tree output
> $ cat inventory.argo.yaml
> $ kubectl --context dest --namespace argocd apply -f inventory.argo.yaml