Overview
This page demonstrates how to set up and use the Traefik Hub API Gateway.
Introduction¶
An API gateway acts as an entry point for a group of Services, providing a centralized API endpoint for the client applications to access the functionality of those Services.
By centralizing the management of APIs, API Gateways simplify the development and maintenance of complex distributed systems.
In Traefik Hub, an API Gateway is the main entry point to all your APIs. This is where you define the public domains for your APIs which are then referenced by linking to your API Accesses resources.
Configure an API Gateway¶
In Traefik Hub, an API Gateway links to one or more API Access resources.
Permissions¶
Permissions are configured via an API Access CRD.
See the following example:
---
apiVersion: hub.traefik.io/v1alpha1
kind: APIAccess
metadata:
name: customer-admin
spec:
groups:
- ignored-atm
apiSelector:
matchLabels:
area: customers
---
apiVersion: hub.traefik.io/v1alpha1
kind: APIAccess
metadata:
name: crm-apis
spec:
groups:
- ignored-atm
apiSelector:
matchLabels:
module: crm
---
apiVersion: hub.traefik.io/v1alpha1
kind: APIAccess
metadata:
name: crm-collections
spec:
groups:
- ignored-atm
apiCollectionSelector:
matchLabels:
module: crm
Custom Resource Definition¶
Use a CRD to set up a Gateway:
---
apiVersion: hub.traefik.io/v1alpha1
kind: APIGateway
metadata:
name: my-gateway
labels:
area: crm
spec:
apiAccesses:
- customer-admin
- crm-collections
- crm-apis
- custom-pick
customDomains:
customDomains:
- api.example.com
- www.api.example.com
API Access¶
Required
spec.apiAccesses
List of allowed groups to access a Gateway.
Custom Domains¶
spec.customDomains
Configure custom domain name for the API Gateway, for example api.example.com.
This is an optional setting, if not configured, Traefik Hub will generate a random domain under the traefikhub.io namespace.
Production deployments
We highly recommend the use of custom domains for production deployments!
Domains generated by Traefik Hub will change with every redeployment, resulting in a new domain.
What's next¶
- Learn more about how to use CRDs to manage APIs
- Follow the tutorial about publishing APIs from CRDs