Chapter 02 of 8
How the Gateway is configured — environment variables, knobs, and where defaults are set in source.
The OpenFaaS Gateway uses a flexible configuration system that supports multiple configuration methods, allowing you to customize the behavior for different deployment scenarios.
The Gateway configuration is organized into logical categories that control different aspects of the system's behavior.
HTTP server settings, port configuration, TLS settings, and basic server behavior.
Function invocation settings, timeout values, and resource allocation parameters.
Kubernetes provider settings, namespace configuration, and cluster-specific options.
Authentication, authorization, CORS settings, and security-related parameters.
Here are some of the most important configuration options that control the Gateway's behavior.
HTTP server port (default: 8080)
Request read timeout (default: 10s)
Response write timeout (default: 10s)
Maximum idle connections (default: 100)
Here's an example of how to configure the Gateway using environment variables in a Kubernetes deployment.
apiVersion: apps/v1kind: Deploymentmetadata: name: openfaas-gatewayspec: template: spec: containers: - name: gateway env: - name: PORT value: "8080" - name: READ_TIMEOUT value: "30s" - name: WRITE_TIMEOUT value: "30s"
Follow these best practices to ensure your Gateway configuration is secure, performant, and maintainable.
Now that you understand how the Gateway is configured, let's explore how the REST API is defined and how requests are routed.