ReactApplication construct simplifies deployment of React and other frontend applications to Kubernetes. It automatically configures environment variables, ingress, and service settings for serving static applications.
Constructor
Properties
Deployment configuration including image, replicas, environment variables, and resource limits.
Domain configuration specifying:
host: The domain name (e.g.,"example.com")paths: Array of URL paths to expose (e.g.,["/"])isSubdomain: Whether this is a subdomain for certificate purposes
Port to expose the application on. This is used for the Kubernetes service and will be set as the
PORT environment variable.Optional ingress configuration to override default settings, such as custom annotations.
Whether to create a Kubernetes service account and attach it to deployment pods. The service account name will be the release name.
Behavior
TheReactApplication construct automatically:
- Sets environment variables: Injects
DOMAIN(the host value) andPORT(the exposed port) - Creates ingress rules: Configures ingress based on the provided domain and paths
- Manages certificates: Uses the
isSubdomainflag to determine certificate generation strategy - Configures service: Creates a Kubernetes service exposing the specified port
Usage Example
Basic React Application
React with Custom Port
Complete Example from README
Example from the Kittyhawk README:React with Subdomain Certificate
React with Multiple Paths
React with Custom Ingress Annotations
Environment Variables
The following environment variables are automatically set:DOMAIN: The host value from the domain configurationPORT: The port number (default:"80")
Related
- Deployments - Configuration options for the underlying deployment
- Ingress - Ingress construct for custom routing
- Certificates - Certificate management for TLS
- DjangoApplication - For backend applications