Provision Infrastructure

The Configuration package we installed in the last section:

  • Defines a CompositePostgreSQLInstance XR.
  • Offers a PostgreSQLInstance claim (XRC) for said XR.
  • Creates a Composition that can satisfy our XR.

This means that an app team could now can create a PostgreSQLInstance XRC in their namespace to provision a PostgreSQL instance and all the supporting infrastructure (VPCs, firewall rules, resource groups, etc) that it may need!

kind: PostgreSQLInstance
name: my-db
namespace: default
storageGB: 20
uxp-guide: getting-started
name: db-conn
kubectl apply -f

After creating the PostgreSQLInstance UXP will begin provisioning a database instance on your provider of choice. Once provisioning is complete, you should see READY: True in the output when you run:

kubectl get postgresqlinstance my-db

Note: while waiting for the PostgreSQLInstance to become ready, you may want to look at other resources in your cluster. The following commands will allow you to view groups of Crossplane resources:

  • kubectl get claim: get all resources of all claim kinds, like PostgreSQLInstance.
  • kubectl get composite: get all resources that are of composite kind, like CompositePostgreSQLInstance.
  • kubectl get managed: get all resources that represent a unit of external infrastructure.
  • kubectl get aws: get all resources related to AWS.
  • kubectl get crossplane: get all resources related to Crossplane.

Try the following command to see whether your provisioned resources are ready:

kubectl get managed -l

Once your PostgreSQLInstance is ready, you should see a Secret in the default namespace named db-conn that contains keys that we defined in XRD. If they were filled by the composition, then they should appear:

$ kubectl describe secrets db-conn
Name: db-conn
Namespace: default
password: 27 bytes
port: 4 bytes
username: 25 bytes
endpoint: 45 bytes

Next Steps

Now you have seen how to provision and consume complex infrastructure using UXP. Next you'll learn how compose and package your own infrastructure APIs.