To import existing resources into Cloud Resource Automation for Crossplane, you can use the kubectl crossplane import command. This allows you to bring existing infrastructure under Crossplane's management by creating a Claim or Composite Resource (XRC) that references the imported resource.
Identify the Resource: Determine the type of resource (e.g., Kubernetes cluster, database, storage) and its provider (e.g., AWS, GCP, Tencent Cloud).
Use kubectl crossplane import: Run the command with the appropriate resource kind and name. For example:
kubectl crossplane import <resource-kind> <resource-name> --provider <provider-name>
Replace <resource-kind> with the resource type (e.g., DatabaseInstance), <resource-name> with the name of the existing resource, and <provider-name> with the provider (e.g., tencent-cloud).
Verify the Import: Check if the resource is now managed by Crossplane:
kubectl get <resource-kind> <resource-name>
If you have an existing MySQL database on Tencent Cloud, you can import it into Crossplane:
kubectl crossplane import databaseinstance mysql-db --provider tencent-cloud
This creates a DatabaseInstance claim managed by Crossplane, allowing you to control the database via Crossplane APIs.
For Tencent Cloud-specific resources, ensure the Tencent Cloud provider is installed and configured in your Crossplane setup. Use kubectl get providers to verify the provider status.
Crossplane's import feature simplifies infrastructure management by unifying existing and new resources under a single control plane.