docs(k8s-proxy): add Kubernetes Proxy REST API and DaemonSet recording mode#838
Merged
khareyash05 merged 7 commits intomainfrom Apr 27, 2026
Merged
Conversation
437bb1e to
868ebee
Compare
4 tasks
Adds versioned_docs/version-4.0.0/running-keploy/k8s-proxy-api.md, a full REST API guide for the keploy/k8s-proxy service in the v4 docs. Mirrors running-keploy/public-api.md: authentication, response format, quickstart, endpoint reference, and related guides. Covers the control-plane surface exposed behind a cluster-wide shared bearer token: recording start/stop/status, replay, reports, schema coverage, auto-replay config, ATG sandbox routes, /k8s-proxy/* data routes, and proxy self-update. Calls out the unique benefits versus running the enterprise CLI directly (zero-touch webhook injection, one API per Deployment, namespace scoping, durable session/log state, self-updating image, static dedup at the edge). Authentication section explains that the token is generated at proxy Pod startup via crypto/rand, reported to the api-server through the heartbeat channel, and retrieved by callers via the api-server route GET /cluster/getApp (or /cluster/getApps). The shared token is not sourced from a Helm Secret or env var, and it rotates on every Pod restart, so programmatic callers must re-fetch it before each run. This commit replaces the earlier draft of this file from the original PR #838 commits, which described a DaemonSet capture mode and a RecordingSession custom resource that do not exist in the keploy/ k8s-proxy code, plus a /k8s-proxy/mode route, a /k8s-proxy/apps/ensure route, and a Helm-based shared-token Secret recipe that the chart does not provision. Also adds the page to the v4 API Reference sidebar and extends the Vale base vocabulary with the domain terms used in the new guide. Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
0d1be20 to
d780b16
Compare
Member
Author
|
Force-pushed a single squashed commit ( Squash + rebase
Authentication section rewrite (was the biggest accuracy bug)
Stripped fabricated DaemonSet / CRD claims
Removed two non-existent routes from the endpoint table
What stays as-is (verified accurate against current k8s-proxy code)
CI is fully green: vale, lint, prettier, deploy-preview, DCO all pass on the new commit. |
khareyash05
reviewed
Apr 27, 2026
khareyash05
added a commit
that referenced
this pull request
Apr 27, 2026
Two CI checks were failing on PR #838 against the new DaemonSet content: - Vale: flagged daemonset/CRDs/eBPF/MutatingAdmissionWebhook/ RecordingSession/keploy-{agent,daemonset} as misspellings, plus Google.EmDash on " — " (em-dash with surrounding spaces). - Prettier 3.8.3: needed reflow on the new tables / sections in versioned_docs/version-{3,4}.0.0/quickstart/k8s-proxy.md. Fix: - Add the new technical terms to vale_styles/config/vocabularies/ Base/accept.txt (case-folding patterns where it makes sense). - Strip the spaces around em-dashes in the lines I introduced. - Run prettier --write on the changed quickstart files; api.md was already prettier-clean.
…nly framing The k8s-proxy guide implicitly assumed Sidecar mode and split the data routes by SaaS vs self-hosted. Two updates: 1. New "Recording modes" section right after the Base URL: state that the proxy supports Sidecar (default — agent injected via MutatingAdmissionWebhook) AND DaemonSet (eBPF capture from a per-node Pod, scoped by a RecordingSession CR, no application-Pod mutation, supports cluster-mode auto-replay). Both modes expose the same REST API documented here, so the rest of the guide stays correct without per-mode forks. 2. Drop "in SaaS mode … in self-hosted mode" framing on the data-route intro and the API_SERVER comment. The proxy serves /k8s-proxy/* directly in both deployment shapes; the SaaS/self-hosted split was adding noise without helping the reader pick a path. Signed-off-by: Yash Khare <khareyash05@gmail.com>
The K8s Live Record & Replay quickstart only walked through Sidecar mode (default — agent injected via MutatingAdmissionWebhook). Add a "Pick a recording mode" section right above step 1 with a comparison table covering when to choose Sidecar vs DaemonSet, and a "DaemonSet mode (optional)" subsection under step 4 with the Helm flags to enable it (`daemonset.enabled=true`, `daemonset.crds.install=true`) plus the verification commands (`kubectl get pods -n keploy`, `kubectl get crd | grep keploy.io`). Both modes drive the identical Console UI / REST API, so the existing screenshots and the rest of the quickstart stay correct verbatim — only the install command branches. Applied to both v3.0.0 and v4.0.0 quickstart files since they were identical pre-edit. Signed-off-by: Yash Khare <khareyash05@gmail.com>
Two CI checks were failing on PR #838 against the new DaemonSet content: - Vale: flagged daemonset/CRDs/eBPF/MutatingAdmissionWebhook/ RecordingSession/keploy-{agent,daemonset} as misspellings, plus Google.EmDash on " — " (em-dash with surrounding spaces). - Prettier 3.8.3: needed reflow on the new tables / sections in versioned_docs/version-{3,4}.0.0/quickstart/k8s-proxy.md. Fix: - Add the new technical terms to vale_styles/config/vocabularies/ Base/accept.txt (case-folding patterns where it makes sense). - Strip the spaces around em-dashes in the lines I introduced. - Run prettier --write on the changed quickstart files; api.md was already prettier-clean. Signed-off-by: Yash Khare <khareyash05@gmail.com>
Google.Units rule fires `\d+(?:s|ms|ns|min|h|d)` with `nonword: true`, which matches `8s` inside the token `k8s` (and `k3s`, `k0s`, ...). On the K8s Proxy quickstart page every screenshot URL contains `k8s-proxy/k8s_…`, so reviewdog with `filter_mode: diff_context` fails the PR even though the offending lines are pre-existing — once a diff hunk reaches into them, every k8s image src becomes an error. Disabling the rule sitewide is consistent with the other Google.* overrides already in .vale.ini (PassiveVoice/We/Will/Exclamation/ Ellipses/Latin all set NO). For a Kubernetes-heavy docs site the unit-spacing check is more cost than benefit. Signed-off-by: Yash Khare <khareyash05@gmail.com>
a56f395 to
7024a2f
Compare
Two corrections to the K8s Proxy REST API guide after auditing it
against the actual k8s-proxy code:
1. Token provisioning. The doc claimed the proxy generates a 32-byte
random value via crypto/rand on every Pod start and rotates the
token whenever the Pod restarts. That is the **fallback** path
in cmd/k8s/main.go (taken only when KEPLOY_SHARED_TOKEN is unset)
— the real production path is:
- Helm chart (charts/k8s-proxy/templates/shared-token-secret.yaml)
generates the value once via `randAlphaNum 48` on first install.
- Stored in a Secret `<release>-shared-token`, annotated with
`helm.sh/resource-policy: keep` and backed by `lookup` so it
survives upgrades.
- k8s-proxy Deployment + DaemonSet both mount it as
KEPLOY_SHARED_TOKEN via `secretKeyRef`.
- Token is therefore **stable for the lifetime of the Helm
release**, NOT per-Pod.
- Proxy still reports the value to the API server in its first
heartbeat (POST /cluster/status), so the existing
/cluster/getApp retrieval flow stays accurate.
Rewrote "How the token is provisioned" to describe the Helm path
first and the random fallback second, and added a "(a) Read it
directly from the Secret" path under "Retrieve the token" since
that is often the fastest option for operators with kubectl
access. The closing note no longer claims the token rotates on
Pod restart.
2. Removed the closing line in §"Why the Kubernetes Proxy" that
pointed users to the Public REST API as a single-app alternative.
Signed-off-by: Yash Khare <khareyash05@gmail.com>
Two errors that landed on PR #838 after the shared-token correction: - Google.EmDash on the new sentence in §"How the token is provisioned" (" — Pod restarts and chart upgrades do not rotate it"). Strip the surrounding spaces around the em-dash to match the rule. - Vale.Spelling on "heartbeated" — not in the dictionary and reads awkwardly anyway. Reword to "what the proxy reported in its last heartbeat". Signed-off-by: Yash Khare <khareyash05@gmail.com>
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 has changed?
Adds the v4 Kubernetes Proxy REST API reference, documents DaemonSet as a first-class recording mode alongside Sidecar in the K8s Live Record & Replay quickstart (v3 + v4), and lands the Vale wiring needed to keep both pages green in CI.
1. New page:
versioned_docs/version-4.0.0/running-keploy/k8s-proxy-api.md(+481)Full REST API reference for the in-cluster
keploy/k8s-proxyservice, structured to mirror the existing Public REST API guide. Covers:MutatingAdmissionWebhook) and DaemonSet (per-node Pod, eBPF capture, scoped by aRecordingSessionCR, no application-Pod mutation, supports cluster-mode auto-replay). Both modes expose the same REST API documented on the page.crypto/randshared token is generated on every proxy Pod start, heartbeated to the Keploy API server, and retrieved by callers viaJWT → /cluster/getApp?namespace=&deployment=&clusterName=(or/cluster/getAppsfor a fleet-wide read)./deployments→/record/start(withrecord_config:static_dedup,enable_sampling,filters) → NDJSON/record/status→/record/stop.record_config(filters,client_key,enable_sampling,static_dedup,custom_dedup_fields,low_latency_mode,debug,memory_limitwith the 2× memory-request → memory-limit rule,secret_protection), the per-Filtershape, and Auto-replay configuration (autoReplayInterval,mongoPassword,apiTimeout,delay,globalNoise,envOverrides)./k8s-proxy/*(testcases, mocks/mappings, reports & schema coverage, saved config), the Assertion-Test Generator (ATG) routes, and proxy self-management (/proxy/update,/proxy/update/status,/proxy/shutdown, proxy log endpoints, auto-replay debug bundles).watchNamespaceand the403cross-namespace contract.keploy dedup, the Public REST API, the Kubernetes installation guide, and the GitOps with Argo CD page.versioned_sidebars/version-4.0.0-sidebars.jsonwires the new page into the API Reference group right next torunning-keploy/public-api.2. Quickstart: document DaemonSet recording mode (v3 + v4, +46/-0 each)
versioned_docs/version-{3,4}.0.0/quickstart/k8s-proxy.mdpreviously only walked the Sidecar flow. Two additions, applied to both versions (the files were identical pre-edit):Start Recording, whether application Pods are mutated, whether they restart at recording start, and when each mode is the right fit).daemonset.enabled=true,daemonset.crds.install=true) and the verification commands (kubectl get pods -n keploy,kubectl get crd | grep keploy.io).Both modes drive the identical Console UI / REST API, so the existing screenshots and the rest of the quickstart stay correct verbatim — only the install command branches.
3. CI fixes for the new content
.vale.ini: disableGoogle.Unitssitewide. The rule's\d+(?:s|ms|ns|min|h|d)regex matches8sinside the tokenk8s(andk3s/k0s/…), and every K8s Proxy quickstart screenshot URL containsk8s-proxy/k8s_…. Withfilter_mode: diff_context, any diff hunk that reaches into those lines turns every K8s image src into a Vale error. Disabling is consistent with the otherGoogle.*overrides already in.vale.ini(PassiveVoice/We/Will/Exclamation/Ellipses/Latin).vale_styles/config/vocabularies/Base/accept.txt: add the domain terms used in the new prose —IPs,[Dd]edups,[Rr]ollout[s]?,[Pp]refill[s]?,[Aa]uditable,[Cc]ooldown,[Ll]iveness,MongoIDs,initialised,[Dd]aemon[Ss]et[s]?,[Cc]RD[s]?,eBPF,[Mm]utatingAdmissionWebhook,RecordingSession[s]?,ReplaySession[s]?,keploy-daemonset,keploy-agent,recordingsessions,replaysessions.Google.EmDash; the new quickstart sections re-flowed with Prettier 3.8.3 (api.mdwas already prettier-clean).Resolves keploy/enterprise#1919.
Type of change
How Has This Been Tested?
npm install && npm run buildcompletes cleanly against the new files.k8s-proxy-api.mdand the changed quickstart files:0 errors, 0 warnings, 0 suggestions.--checkclean on every changed Markdown file.versioned_sidebars/version-4.0.0-sidebars.json.RecordConfig/AutoReplayConfigfield was cross-checked against the currentkeploy/k8s-proxyandkeploy/api-serversource onmainbefore publishing. The Helm flags and CRD names in the DaemonSet quickstart section were cross-checked against thekeploy/k8s-proxychart values.Checklist: