Before you migrate application configurations from a Swarm cluster to a Kubernetes cluster, you must set up the environment for migration. This topic describes how to set up the environment for migration.

Background information

Kompose is an open source tool that is used to convert Swarm compose files into Kubernetes resource files. Alibaba Cloud has optimized Kompose to support labels that are specific to Alibaba Cloud.

After Kubernetes resource files are generated, you can Use kubectl to connect to an ACK cluster and deploy these files in a Kubernetes cluster.

Kompose and kubectl are required to migrate application configurations. We recommend that you install Kompose and kubectl on a dedicated Elastic Compute Service (ECS) instance.

Procedure

  1. Install Kompose.

    Kompose is a tool that is used to convert Swarm compose files into Kubernetes resource files. Alibaba Cloud has optimized Kompose to support labels that are specific to Alibaba Cloud. For more information about Kompose, see AliyunContainerService/kompose.

    Installation: Download the latest executable file AliyunContainerService/kompose/releases from GitHub based on your operating system.
    kompose-linux-amd64
    kompose
  2. Set up the environment for kubectl.
    1. Download the latest kubectl client from the Kubernetes change log page.
    2. Install and set up the kubectl client. For more information, see Install and set up kubectl.
    3. Configure cluster credentials.
      1. Log on to the Container Service for Kubernetes (ACK) console.
      2. In the left-side navigation pane, click Clusters.
      3. On the Clusters page, find the cluster that you want to manage and click the name or click Details in the Actions column.
      4. On the Basic Information tab, copy and paste the KubeConfig content to $HOME/.kube/config on your on-premises machine.
    4. After the setup is complete, run the following commands to check whether the installation is successful and cluster credentials are correctly configured.
      kubectl version
      
      kubectl cluster-info

Result

If the output is as shown in the following red box, it indicates that kubectl is installed and the migration environment is set up.Environment is set up