DEV Community

Cover image for Crossplane and operators interactions
Maxime Guilbert
Maxime Guilbert

Posted on

Crossplane and operators interactions

In this new post about Kubernetes operators, we will talk about an operator which already exist : Crossplane.

What is Crossplane?

Crossplane is a Kubernetes operator which allows you to manage cloud resources from Kubernetes. These cloud resources can come from differents cloud providers like AWS, GCP...

It means that from your Kubernetes cluster, you can dynamically create resources in a cloud.

The following example will create a S3 bucket in AWS.

kind: Bucket 
    generateName: crossplane-bucket- 
    labels: provider-aws 
        region: us-east-2 
        name: default
Enter fullscreen mode Exit fullscreen mode

This is crazy, isn't it?

How to install Crossplane?

If you are interested by using Crossplane on your cluster and using it, you can check the following links where everything is well explained for each cloud provider:

Using Crossplane from another operator!?

As we installed Crossplane in our Kubernetes cluster, all its custom resources are now available in the cluster. So our operator can use them to manage new resource instances.

In previous posts of this serie, we mentionned that we can use an operator to manage Grafana, Prometheus, Postgres and OpenTelemetry deployments. With our new context, as the 3 first are available in AWS, it means that our operator can dynamically create these resources in AWS!

*Note: For all the following examples, I will only talk about AWS but it will be similar for other cloud providers.

Download libraries

The first thing to do in our operator is to download crossplane librairies.

go install 
go install
Enter fullscreen mode Exit fullscreen mode

They will allow us to access to all the common Crossplane resources and all the specific resources for AWS.

Manage schemas

In the main.go file, there is a init function that we ignore until now.

func init() {  
Enter fullscreen mode Exit fullscreen mode

Declared like this, it will give access to the operator to all the basic Kubernetes resources with the method AddToScheme.

So if we want to be able to use custom resources from Crossplane, we must add another declaration.

import (
    crossplane ""

func init() {  
Enter fullscreen mode Exit fullscreen mode

Always working with the same pattern, you need to import the AddToScheme function of the librairie containing all the resources you want to work with, and all it in the init function.


It's something really important to not forget! Go add all the annotations you need to give the correct rights to your operator on the new resources.

Using new resources

Now that we have everything setup to be able to use the Crossplane resources from our operator, we can use them in our Reconcile method!


import (

    myBucket := &v1beta1.Bucket{} // Refers to an AWS S3 Bucket
    err := r.Get(ctx, req.NamespacedName, myBucket)
Enter fullscreen mode Exit fullscreen mode


We discovered Crossplane in this post and saw that it's possible to make interactions between operators.
And there are a LOT of operators! Datadog, Grafana, Kong or Litmus Chaos for example.

Check if you want to find a list of operators.

Also, with what we saw today, we are now able to create operators like microservices, with each of them have a focused scope and make things easier to develop and scale. So think about all the things which can be done in full automation!

Talking about automation, in the next post of this serie, we will talk about Crossplane vs Terraform.

I hope it will help you and if you have any questions (there are not dumb questions) or some points are not clear for you, don't hesitate to add your question in the comments or to contact me directly on LinkedIn.

You want to support me?

Buy Me A Coffee

Top comments (0)