cpln convert
Overview
The cpln convert command is designed to facilitate the migration from Kubernetes environments to Control Plane by converting Kubernetes objects into Control Plane objects.
Typically, this command is utilized alongside the cpln apply command to seamlessly convert and then directly apply the configurations.
Prerequisites
- CLI installed.
Options
Required
--file
- A
JSON
/YAML
file containing Kubernetes objects. Use--file -
to enable input from stdin.
- A
Optional
--protocol
- The port protocol to be assigned to each container within a workload converted from a deployment. Default:
http
. [choices:http
,http2
,grpc
,tcp
].
- The port protocol to be assigned to each container within a workload converted from a deployment. Default:
Limitations
The cpln convert command has specific conversion capabilities, detailed as follows:
- Workloads Conversion
- Can convert objects of kind Deployment and CronJob into workloads.
- Secrets Conversion
- Capable of converting objects of kind Secret into Control Plane secrets.
Create a K8s file
To demonstrate the convert
command, create a k8s.yaml
file with the following content:
Convert a K8s file
Basic Convert
The following command will convert the Kubernetes object defined in the above k8s.yaml
file into a Control Plane object and output it to the terminal.
Convert With a Specific Protocol
Each Kubernetes object, whether of type Deployment
or CronJob
, will be transformed into workloads. These workloads will feature containers whose port protocols are aligned with the specification provided in the --protocol
option.
Convert & Apply
Use the cpln apply command to convert and apply.
Alternatively, you can pass the conversion result as a stdin to the cpln apply command.
cpln convert --file k8s.yaml | cpln apply --file -
Revert Apply
To revert the apply, use the following command.