This tutorial explains how to create and manage API collections.
In this tutorial, you'll learn how to create and manage API collections with CRDs.
Collections are managed with the API collection selector.
Please check the official Kubernetes documentation if you want to learn more about Labels and Selectors.
- An API can be part of multiple collections
- Labels and selectors are used for grouping
This example CRD creates an API collection with the name crm-all and all APIs with the matching label crm will be part of this collection.
All user of the group crm-group will have access to this API collection.
||PathPrefix used by the collection, for example /crm.
The PathPrefix will append the URL of the API Gateway.
This would make the API collection accessible under api.example.com/crm.
Only absolute paths are accepted for this setting.
||Select APIs based on Labels.||No|
||Select APIs based on Selectors.||No|
Save the following YAML file as
apiVersion: hub.traefik.io/v1alpha1 kind: APICollection metadata: name: crm-all labels: module: crm spec: groups: - crm-group pathPrefix: "/crm" apiSelector: matchLabels: module: crm
kubectl commands to deploy the collection CRD:
kubectl apply -f api-collection.yaml
In this tutorial, you learned how to create and manage API collections with CRDs and through the UI.
- Learn how to deploy APIs with CRDs