CODER_AGENT_URL server environment variable should override ACCESS_URL in agent #23048
schnell3526
started this conversation in
Feature Request
Replies: 1 comment 1 reply
-
|
You need to set it per template. See these docs: https://registry.terraform.io/providers/coder/coder/latest/docs#url-1 This should update the |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
When running Coder on Kubernetes with an internet-facing load balancer, workspace agents
cannot download the Coder binary or connect to the server because the bootstrap script uses
CODER_ACCESS_URL for both browser access and agent communication.
In our setup:
within the VPC (traffic would need to hairpin through NAT Gateway, and the ALB security group
only allows VPN source IPs)
The agent bootstrap script (provisionersdk/scripts/bootstrap_linux.sh) uses ${ACCESS_URL} for
both binary download and CODER_AGENT_URL:
And ACCESS_URL is set from s.AccessURL in provisioner/terraform/provision.go:
where GetCoderUrl() always returns CODER_ACCESS_URL.
Expected behavior
CODER_AGENT_URL is already a recognized environment variable on the agent side (cli/root.go),
but setting it as a server-side environment variable has no effect on the provisioner's
CoderUrl.
I'd expect that if CODER_AGENT_URL is set on the server, it should be used as the CoderUrl
passed to the provisioner, overriding CODER_ACCESS_URL for agent bootstrap and communication.
Workaround
We work around this by adding NAT Gateway EIPs to the ALB security group, so that pods can
reach the internet-facing ALB via hairpin routing (Pod → NAT Gateway → ALB → Coder). This
works but adds unnecessary network overhead for what should be cluster-internal
communication.
Use case
This is a common Kubernetes pattern: external users access services through an
internet-facing load balancer, while internal pods communicate via ClusterIP services.
Coder's current design assumes CODER_ACCESS_URL is reachable from both browsers and agents,
which isn't always the case.
Beta Was this translation helpful? Give feedback.
All reactions