How to import existing resources

I would like my existing resources to be managed by Kubernetes. This would allow me to use gitops and use other benefits I get from my Kubernetes installation.

I was hoping you could give me some guidance. From my experience I was hoping I could do something like Terraform: Import Terraform Configuration | Terraform - HashiCorp Learn

Thanks!

Hi colltoaction:

It’s not clear to me what you mean with “resources”. If your resources are “things” deployed to Kubernetes, they are already managed by Kubernetes… ¯\_(ツ)_/¯

If by “resources” you are refering to VMs and other “things” on some hyperscaler, you may take a look at https://crossplane.io/. It turns Kubernetes in a single-point of contact between you and resources deployed in your hyperscaler, so instead of using aws-cli or gcloud to create “things” on the cloud, you use kubectl apply -f alb_autoscalinggroup_webserver.yaml

Don’t know if CrossPlane actually have some kind of importing capacity as Terraform has…

You can use GitOps with Terraform: commit your updated code, and trigger something that runs terraform plan and terraform apply… (We use it at work to deploy and manage “things” :wink: in a GitOps manner using the Cloud Build service in Google Cloud Platform)

Best regards,

Xavi

You can import existing resources to Crossplane by adding a crossplane.io/external-name annotation to the resource definition with the value set to the name of the existing resource.