liveBook · Manning

Crossplane

As explained in Platform Engineering on Kubernetes

Crossplane is an open-source Kubernetes extension for provisioning and managing infrastructure and cloud services through Kubernetes APIs and declarative resources.

Crossplane extends Kubernetes so teams can provision and manage application infrastructure through declarative Kubernetes resources. Instead of maintaining every database or message broker inside an application Helm chart, a team can request infrastructure through the same API and tooling it uses for workloads. Crossplane runs in a Kubernetes cluster; installed providers connect it to cloud services or, for local development, Helm releases. section 5.2 section 5.3

A request passes through three layers:

  • A provider understands a particular service and provisions its managed resources. The provider needs an account and permissions appropriate to those resources. section 5.2.1 section 5.2.3
  • A Composite Resource Definition (XRD) defines a simpler API for application teams. A composition supplies the underlying resources and configuration, such as a database plus its networking and credentials. section 5.2.2
  • An application team creates a resource using that API. Its label selector chooses an available composition, allowing the implementation or provider to change without changing the basic request interface. section 5.3

Requesting Conference application infrastructure

The Conference application needs Redis, PostgreSQL, and Kafka. For a local setup, compositions use the Crossplane Helm provider to create those components separately from the application chart. A Database request can select a SQL composition with `provider: local`, `type: dev`, and `kind: sql`; another selector can request a GCP SQL implementation. Check the resulting resources with `kubectl get dbs` and `kubectl get mbs`: the shown requests report `SYNCED` and `READY` as `True`. Deploy the application with `install.infrastructure=false`, then supply the provisioned service addresses and credential secret names in its Helm values. Otherwise, disabling the chart’s infrastructure dependencies leaves services without connection details. section 5.3 section 5.3.1

Listing 5.10 Database resource with kind: sql label to select implementation
apiVersion: salaboy.com/v1alpha1
kind: Database
metadata:
  name: my-db-sql      #1
spec:
  compositionSelector:
    matchLabels:
      provider: local
      type: dev
      kind: sql        #2
  parameters: 
    size: small
    mockData: false

This Database manifest shows how a small request selects the local SQL composition using labels rather than specifying a PostgreSQL Helm release. section 5.3

Providers continually observe managed resources and report their state through Kubernetes. Desired parameters guide reconciliation, while reported state helps teams spot differences from the requested configuration. Crossplane can therefore give platform teams control over complex provisioning while giving application teams smaller, self-service APIs. That separation still requires a Kubernetes-capable platform team and carefully configured provider access. section 5.2.4 section 5.4

How Platform Engineering on Kubernetes covers it

How deep it goes
Works through providers, XRDs, compositions, selectors, reconciliation, and application connection settings; defers installation commands to a step-by-step tutorial.
Examples
Demonstrates GCP bucket provisioning and Conference application requests for Redis, PostgreSQL, and Kafka through compositions.
What it assumes
Assumes a Kubernetes cluster and configured provider permissions; uses a local Helm provider when cloud-provider access is unavailable.
What you can do after
Apply it via Crossplane, kubectl, and Helm to request infrastructure, inspect readiness, and connect application services.
How it connects
Connects Kubernetes APIs, Helm charts, managed resources, composite resources, GitOps, and cloud-provider services.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Platform Engineering on Kubernetes. The section links point to the parts of the book it draws on.