An introductory example to Crossplane and Compositions using provider-nop. This will enable provisioning of several different fake resource types.
This repository contains a reference configuration for Crossplane. This configuration is built with provider-nop, a Crossplane provider that simulates the creation of external resources.
This platform offers APIs for setting up a variety of basic resources that mirror what you'd find in a Cloud Service Provider such as AWS, Azure, or GCP. The resource types include:
- Cluster, a resource that loosely represents a Kubernetes cluster.
- NodePool, a resource that loosely represents a Nodepool in a Kubernetes cluster.
- Database, a resource that loosely represents a cloud database.
- Network, a resource that loosely represents a cloud network resource.
- Subnetwork, a resource that loosely represents a subnetwork resource within a cloud network.
- Service Account, a resource that loosely represents a service account in the cloud.
This configuration also demonstrates the power of Crossplane to build abstractions called "compositions", which assemble multiple basic resources into a more complex resource. These are demonstrated with:
- CompositeCluster, a resource abstraction that composes a cluster, nodepool, network, subnetwork, and service account.
- AccountScaffold, a resource abstraction that composes a service account, network, and subnetwork.
Learn more about Composite Resources in the Crossplane Docs.
Before we can install the reference platform we should install the up CLI.
This is a utility that makes following this quickstart guide easier. Everything
described here can also be done in a declarative approach - which we highly
recommend for any production type use-case.
To install up run this install script:
curl -sL https://cli.upbound.io | shSee up docs for more install options.
We need a running Crossplane control plane to install our instance. Use Upbound to create a managed control plane. You can create an account and start a free 30 day trial if you haven't signed up for Upbound before.
Now you can install this reference platform. It's packaged as a Crossplane configuration package so there is a single command to install it:
up ctp configuration install xpkg.upbound.io/upbound/configuration-getting-started:v0.1.0Validate the install by inspecting the provider and configuration packages:
kubectl get providers,providerrevision
kubectl get configurations,configurationrevisionsCheck the marketplace for the latest version of this platform.
🎉 Congratulations. You have just installed your first Crossplane-powered platform!
You can now use the managed control plane to request resources which will simulate getting provisioned in an external cloud service. You do this by creating "claims" against the APIs available on yuor control palne. In our example here we simply create the claims directly:
Create a custom defined cluster:
kubectl apply -f examples/XCluster/claim.yamlCreate a custom defined database:
kubectl apply -f examples/XDatabase/claim.yamlYou can verify the status by inspecting the claims, composites and managed resources:
kubectl get claim,composite,managedTo delete the provisioned resources you would simply delete the claims:
kubectl delete -f examples/XCluster/claim.yaml,examples/XDatabase/claim.yamlTo uninstall the provider & platform configuration:
kubectl delete configurations.pkg.crossplane.io configuration-getting-startedWe recommend you check out of one of Upbound's platform reference architectures to learn how to use Crossplane to provision real external resources, such as in a Cloud Serice Provider's environment. Have a look:
For any questions, thoughts and comments don't hesitate to reach out or drop by slack.crossplane.io, and say hi!