When querying the API (OSS on Kubernetes), I can o...
# ask-ai
s
When querying the API (OSS on Kubernetes), I can often get "connection refused" with several retries if I'm polling several jobs at once, and the api server restarting. But when I look at the pod resource usage, it's way below the limits. Where could the resource constraint be in my airbyte deployment?
k
Based on the information in the knowledge sources, "connection refused" errors and API server restarts in Airbyte OSS on Kubernetes—despite pod resource usage being below limits—can be caused by several factors beyond just the pod-level CPU and memory limits: 1. Kubernetes Resource Requests vs. Limits: Even if your pods are not hitting their resource limits, if the requested resources are high relative to what's available on your nodes, Kubernetes may throttle or delay pod scheduling, leading to connection issues. It's important to monitor both requested and used resources. If high requested CPU or memory is blocking new pods from being scheduled, you may need to adjust the defaults in your
values.yaml
to lower requests, not just limits. This can help ensure that more pods can be scheduled concurrently, especially during bursts of activity like polling many jobs at once. Example configuration:
Copy code
yaml     global:       jobs:         resources:           limits:             cpu: 250m             memory: 500m           requests:             cpu: 75m             memory: 150m
[Scaling Airbyte After Installation](https://docs.airbyte.com/platform/1.7/enterprise-setup/scaling-airbyte) 2. Concurrent Syncs and API Load: Airbyte's architecture means that each concurrent sync spawns multiple pods. If you are polling several jobs at once, you may be hitting the maximum number of concurrent syncs or overwhelming the API server with requests. This can cause the API server to become unresponsive or restart, even if individual pod resource usage appears low. You can control concurrency with environment variables:
Copy code
yaml     worker:       extraEnvs:         - name: MAX_SYNC_WORKERS           value: "5"         - name: MAX_CHECK_WORKERS           value: "5"
[Scaling Airbyte After Installation](https://docs.airbyte.com/platform/1.7/enterprise-setup/scaling-airbyte) 3. Cluster-Level Resource Constraints: Sometimes, the bottleneck is not at the pod level but at the node or cluster level (e.g., network, disk I/O, or Kubernetes API server resource exhaustion). If the cluster is under-provisioned or if there are too many pods for the available nodes, you may see connection issues even if individual pods are not using much CPU or memory. 4. Other System Limits: There could be limits on the number of open file descriptors, network connections, or threads at the node or container runtime level, which are not directly visible in pod resource metrics. For example, thread or connection exhaustion can cause the API server to crash or refuse connections, as seen in some user reports of thread leaks or resource exhaustion in Airbyte components [Resource leak in airbyte-worker](https://discuss.airbyte.io/t/2309). Summary: The resource constraint may not be with the pod's CPU/memory usage, but rather with Kubernetes scheduling (requests vs. limits), cluster-level resource exhaustion, or system-level limits (threads, connections). Review your
values.yaml
for both requests and limits, monitor cluster-wide resources, and consider tuning concurrency settings to avoid overwhelming the API server. If you continue to see API server restarts, check the server logs for more details, as there may be additional clues about the underlying cause. If the problem persists, consider scaling up your cluster or distributing the load more evenly across time. If you need more specific troubleshooting steps, please provide relevant logs or error messages from the API server pod.