Skip to content

datalayer-examples/crossplane-example

Repository files navigation

Datalayer

Crossplane Examples

This repository showcases different usecase for Crossplane on top of Google Cloud. It aims to complement the official Crossplane documentation to give step-by-step examples to deploy infrastructure and services on Google Cloud. It focuses on GCP but can be applied to other clouds like Amazon, Azure...

You can read more context about Crossplane on the companion blog post Crossplane by example.

Ensure you have credits to spend on GCloud to run these examples.

We have a first section with use case like settting-up the environment, deploying managed and composite resources as helm chart... We also have a second section where we build a custom React.js user interface interacting with a managed database.

We are trying to stick to some definitions:

  • Control cluster: The Kubernetes cluster that hosts the Crossplane operator, in our case a Kind cluster.
  • Managed resources: The managed infrastructure like Kubernetes clusters, databases, IAM roles... created by the Control cluster and running in the cloud.
  • Workload cluster: The Kubernetes managed clusters created by the Control cluster and running in the cloud.

Use Cases

You are expected to start from step 1 and follow-up step by step until the end. If you jump directly to a specific step, ensure your environment, including the shell environment variables, are set as expected.

Step 1: Create GCloud Project.

Step 2: Create a Control Cluster.

Step 3: Create a GCP Provider on the Control Cluster

Step 4: Create GCP managed Resources.

Step 5: Deploy Helm Releases.

Step 6: Deploy a Composition.

Step 7: Deploy a Reference Platform.

Step 8: Deploy a Wordpress Cluster.

Step 9: Destroy.

How to Troubleshoot if needed, hopefully not too much.

Custom Web User Interface

Build and deploy a UI to insert and view a list of rows from a Postgresql table deployed on GCP. Follow these instructions to get the following UI in your browser.

Bare Minimum Setup

Assuming you have a created a GCloud project and created a Control cluster, the bare minimun to run is the following.

./sbin/create-kind.sh
./sbin/crossplane-gcp-min.sh <YOUR_RANDOM_PROJECT_NUMBER>