How to use "move2kube collect" command?

12/21/2021

I am new to movetokube tool. I am struggling to understand how the move2kube collect command works. The web site doesn't have any documentation on this command which is very surprising. I want to get all the applications installed in the Cloud Foundary cluster and I hope move2kube does this through move2kube collect command (or not?). I am not sure sure whether I have to execute the move2kube command on the Cloud Foundary cluster or K8 cluster. Please help!

I am executing the following move2kube command on a CF cluster

move2kube collect

I see the following error

INFO[0000] Begin collection
INFO[0000] [*collector.ClusterCollector] Begin collection
WARN[0001] Error while fetching storage classes using command [/usr/local/bin/kubectl get sc -o yaml]
ERRO[0001] API request for server-group list failed
WARN[0001] Failed to retrieve preferred group information from cluster
WARN[0001] Failed to collect using the API. Error: "Get \"https://cluster02.someserver.com:8443/api?timeout=32s\": failed to refresh token: oauth2: cannot fetch token: 401 \nResponse: {\"error\":\"unauthorized\",\"error_description\":\"Bad credentials\"}" . Falling back to using the CLI.
ERRO[0001] Error while running kubectl api-resources: exit status 1
WARN[0001] Failed to collect using the CLI. Error: "exit status 1"
WARN[0001] [*collector.ClusterCollector] failed. Error: "exit status 1"
INFO[0001] [*collector.ImagesCollector] Begin collection
INFO[0001] [*collector.ImagesCollector] Done
INFO[0001] [*collector.CFContainerTypesCollector] Begin collection
WARN[0002] Error while getting buildpacks : exit status 1
WARN[0002] Unable to collect buildpacks from cf instance : exit status 1
ERRO[0002] exit status 1
WARN[0002] Unable to find used buildpacks : exit status 1
INFO[0004] [*collector.CFContainerTypesCollector] Done
INFO[0004] [*collector.CfAppsCollector] Begin collection
ERRO[0004] exit status 1
WARN[0004] [*collector.CfAppsCollector] failed. Error: "exit status 1"
INFO[0004] Collection done
INFO[0004] Collect Output in [/home/mytest/move2kube/samples/m2k_collect]. Copy this directory into the source directory to be used for planning.
-- KurioZ7
cloud-foundry
kubernetes
move2kube

1 Answer

12/22/2021

From the move2kube GitHub page:

Usage

One step Simple approach

move2kube transform -s src

Two step involved approach 1. Plan : Place source code in a directory say src and generate a plan. For example, you can use the samples directory. move2kube plan -s src 2. Transform : In the same directory, invoke the below command. move2kube transform

Note: If information about any runtime instance say cloud foundry or kubernetes cluster needs to be collected use move2kube collect. You can place the collected data in the src directory used in the plan.

And from the article Introducing Konveyor Move2Kube on Medium:

Move2Kube Usage

Move2Kube takes as input the source artifacts and outputs the target deployment artifacts.

Move2Kube accomplishes the above activities using a 3 step approach of

  1. Collect : If runtime inspection is required, move2kube collect will analyse your runtime environment such as cloud foundry or kubernetes, extract the required metadata and output them as yaml files in m2k_collect folder.

...

-- Andrew Skorkin
Source: StackOverflow