- Download a Swarm Compose file.
- Log on to the Container Service for Swarm console. In the left-side navigation pane, click Applications. On the Applications page, find the application that you want to migrate and click Change Configuration in the Actions column.
- Copy the configurations and save them in a YAML file on the on-premises machine. In this topic, the file is named swarm-piggymetrics.yaml, which is the Swarm Compose file that you can pre-process.
- Replace environment variables in the Swarm compose file with actual values.The Container Service for Swarm console allows you to use a configuration file to replace variables in a Swarm compose file with actual values. Kubernetes does not support this feature. Before you use Kompose to convert a Swarm compose file, you must manually replace the dollar signs ($) in the compose file with actual values. To replace variables in the Swarm compose file, perform the following steps:
- Log on to the Container Service for Swarm console. In the left-side navigation pane, click Configurations. On the page that appears, select the region where the configuration file is deployed and find the configuration file.
- Replace the dollar signs ($) in the swarm-piggymetrics.yaml file with the actual values based on this configuration file.
- Pre-process labels.You must pre-process the labels in the Swarm compose file. Otherwise, Kompose may report an error and stop the conversion as a result of invalid formats or unsupported labels. The following text describes the two major methods of label processing. For more information about each label, see Application configuration parameters, Application release parameters, Network configuration labels, and Log configuration parameters.
- Change the values of the following labels from BOOLEAN to STRING. For example, change
true or false to
- Kubernetes Services with labels that contain the following value cannot be migrated.
You must delete them and create new ones with the same configurations in the related
- Change the values of the following labels from BOOLEAN to STRING. For example, change true or false to
- Modify the version number of the Swarm compose file.Kompose supports Swarm compose files of version 2. You must change the version declaration from version: '2.X' to version: '2' in the Swarm compose file. Otherwise, an error will occur during conversion.