Repository navigation
feat(apexkube-agent): access + metrics agents in one release, separate tunnels - #157
Merged
Merged
Conversation
Run the access agent (Kubernetes API; TLS, client JWT, service account token) and optionally a second metrics agent in the same release. Both use the same image, but each has its own Deployment, ServiceAccount, envoy config and WireGuard identity, so scrape volume stays off the access pod and its tunnel. Defaults deploy only the access agent and render identically to 2.0.0. Setting metrics.enabled adds a plain-HTTP agent pointing at metrics.envoy.backend (thanos-receive:10908 by default), with its own resources, no service account token and no cluster-wide RBAC. access.enabled=false gives a metrics-only install. The access agent also gains envoy.backend.host/port, envoy.backend.tls.enabled, envoy.tls.enabled, envoy.jwt.enabled and envoy.injectServiceAccountToken. Its Lua filter now reads the projected token per request instead of caching it, so a rotated token is used on the next request and the filter no longer depends on os.time().
Luv7804
force-pushed
the
agent/feat/apexkube-agent-profiles
branch
from
October 30, 2026 12:55
3696f3a to
375f84c
Compare
ChandanTeekinavar
approved these changes
Oct 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
One release can now run one or two agents from the same image:
access(default)metrics(metrics.enabled)kubernetes.default.svc:443+ TLSmetrics.envoy.backend(thanos-receive:10908), plain HTTPAuthorization: Bearerwg0+ keywg0+ keyenvoy.resourcesmetrics.resources(bigger, for scrape bursts)metrics.enabled: trueadds<fullname>-metrics: its own Deployment, ServiceAccount, envoy ConfigMap, WireGuard ConfigMap and private-key Secret. Because the tunnel lives in the pod, scrapes consume only the metrics pod's CPU/memory limits and never share the access tunnel's queues.access.enabled: falsegives a metrics-only install, with no access pod, no certificate Secret and no cluster-wide RBAC at all.The access agent also gains
envoy.backend.host/port,envoy.backend.tls.enabled,envoy.tls.enabled,envoy.jwt.enabledandenvoy.injectServiceAccountToken, so a single-pod install can point elsewhere without deploying the second pod.Requirement: the metrics agent needs its own WireGuard peer (own key pair and tunnel address), ideally with
AllowedIPsscoped server-side to the Thanos endpoint.Service account token fix
The Lua filter cached the projected token for the life of the worker, so a rotated token was never picked up (masked on k3s, which extends token expiry). It now reads the file per request — no clock dependency, since
os.time()availability in Envoy's sandbox is not guaranteed.Verification
helm templateof 2.0.0 vs 2.1.0 for defaults,ci/ci-values.yamland a real production values file — identical apart from the Lua block and the version-derived labels/checksums.helm lintclean for defaults, both CI files andvalues-metrics.yaml.wg0addresses (10.90.0.2/32 and 10.90.1.2/32), each pod returned 200 through its own envoy to a plain-HTTP echo backend; the access pod injectedAuthorization: Bearer <token>, the metrics pod injected nothing. Exactly one ClusterRole/ClusterRoleBinding existed for the release, both belonging to the access agent.ct installcovers both profiles (ci-values.yamlandci-metrics-values.yaml), so envoy is booted with each rendered config in a kind cluster./healthz200 through the tunnel,/version401 (JWT filter active).Not in this PR
monitoring,hydra11,hydra31,management-dev) — INTINF-428 / AK-196.inline_codein the Lua filter is deprecated by Envoy; switching tosource_code.inline_stringwould change the default rendering, so it is left for a separate change.