Keploy logo
Kubernetes logo

Keploy as a Kubernetes testing framework

Keploy records traffic inside a running Kubernetes pod, capturing the requests a service serves and every downstream call it makes across the cluster, then replays them in CI. No test cluster, ephemeral namespace, or service mesh is needed to run the resulting tests.

Generate Kubernetes tests free
keploy record -c "./orders-service"
18.4K+VS Code1.2M+300M+mocks created

What Keploy gives a Kubernetes team

Any workload, any language

Keploy records inside the pod at the socket layer, so the container image, language, and framework do not matter. A Deployment, StatefulSet, or Job all record the same way.

  • Any container image or runtime
  • Deployments, StatefulSets, and Jobs
  • No sidecar injection required
  • No mesh or CNI dependency
The problem

Why Kubernetes integration tests slow teams down

The friction is rarely the assertions. It is everything around them — spinning up dependencies, keeping mocks honest, and repairing tests after every refactor.

Three ways to do it

Testing Kubernetes: by hand, with ephemeral namespaces, or with Keploy

Ephemeral namespaces give real cluster fidelity and make every pipeline wait for a full stack. Keploy records that stack once and replays it as a plain process.

Select any row for the full comparison, with code.

Same coverage, three costs

What you write for Kubernetes vs what Keploy records

All three produce the same assertion. Only the third still passes after the next refactor without anyone editing it.

By hand2–4 hours
deps_fakes.go
hand-written
// Hand-written: one fake per dependent service.
package testsupport
 
// Three services this one calls, three fakes to maintain.
type FakeInventory struct{}
 
func (FakeInventory) Reserve(sku string, n int) error { return nil }
 
type FakePricing struct{}
 
func (FakePricing) Quote(sku string) (int64, error) { return 4200, nil }
 
type FakeNotifications struct{}
 
func (FakeNotifications) Send(userID, template string) error { return nil }

Three fakes for three services, each encoding a contract another team owns. Every one of them goes stale the week that team ships.

ephemeral namespaces1–2 hours
ci-ephemeral-namespace.yaml
tool-assisted
# An ephemeral namespace per pull request.
name: integration
on: [pull_request]
jobs:
e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create namespace
run: kubectl create namespace pr-${{ github.event.number }}
- name: Install the whole stack
run: helm install stack ./charts --namespace pr-${{ github.event.number }}
# Every dependency has to become ready before the first assertion.
- name: Wait for readiness
run: kubectl wait --for=condition=ready pod --all --timeout=600s
- name: Seed data
run: ./scripts/seed.sh
- name: Run tests
run: go test ./e2e/...

The highest-fidelity option there is, and the pipeline spends most of its time installing charts and waiting for pods rather than testing.

With Keploy~5 minutes
ci-replay.yaml
auto-generated
# Replay recorded pod traffic — no cluster involved.
name: integration
on: [pull_request]
jobs:
replay:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Keploy
run: curl -sSL https://keploy.io/install.sh | bash
- name: Build
run: go build -o orders-service ./cmd/service
# No namespace, no Helm, no readiness wait, no seed step.
- name: Replay
run: keploy test -c "./orders-service" --delay 8

The recorded pod traffic includes every downstream service call, so this job exercises the same request path without deploying a single dependency.

Times are estimates for authoring one endpoint’s coverage from scratch, not measurements.

Keploy vs the alternatives

Kubernetes testing tools, compared

The options a team on service and platform integrations actually reaches for, and where each one genuinely wins. Select a row for the full comparison.

Best in classStrongPartialNot covered

Assessments reflect each tool’s documented behaviour, not benchmark measurements.

How it works

Record your Kubernetes app once, replay it forever

Keploy sits below your Kubernetes process at the network layer. It watches the calls your app already makes, then serves them back on replay so tests run with no dependencies attached.

Keploy records a GET call to /api/v1/orders/{id} on a Kubernetes service and captures the dependency calls it makes.

Kubernetes logo
Your Kubernetes app
GET/api/v1/orders/{id}200
RecordingKeploy proxyeBPF · userspace
Service-to-service HTTP
Service-to-service HTTPAny in-cluster REST call between pods
+4 more Kubernetes dependencies
An example shape of a captured call. Your own endpoints and dependencies come from your real traffic, so nothing here has to be written by hand.
Mock coverage

What Keploy mocks for Kubernetes, with zero config

7 of the 8 dependencies a typical Kubernetes service talks to are stubbed from the recording itself — no mock classes, no fixture files, no containers in CI.

Quick start

Your first Kubernetes test suite in under five minutes

Every command below runs against your existing Kubernetes service. Nothing in your source tree changes.

  1. 1Install the Keploy CLI

    A single binary. It needs a Linux kernel with eBPF support, or Docker on macOS and Windows — and it adds nothing to your project's dependencies.

    curl -sSL https://keploy.io/install.sh | bash
  2. 2Record your service

    Pass the command you already use to start the app. Keploy runs it and watches every socket it opens.

    keploy record -c "./orders-service"
  3. 3Exercise the paths you care about

    Record inside the pod while real traffic flows. Every downstream service, database, and cache call the request triggered is captured with it.

    kubectl port-forward svc/orders 8080:80
    curl -X POST localhost:8080/orders/ord_1/confirm -d '{"paymentToken":"tok_123"}'
  4. 4Replay in CI

    Replay serves the recorded dependency responses, so the job needs no service containers and no Docker daemon.

    keploy test -c "./orders-service" --delay 8

Ready to try it on your own Kubernetes service?

Ecosystem

Works with the rest of your Kubernetes stack

Keploy records at the network layer, so framework and driver choices inside your Kubernetes app do not change how it captures traffic.

FAQ

Kubernetes testing with Keploy: common questions

Join our GlobalCommunity

Connect with developers worldwide. Follow updates, ask questions, share feedback, and ship faster with other Keploy builders.

1.2M+Installs
18.4K+GitHub
100K+Devs
300M+Mocks
1K+Contributors
#1OSS Trending
4.9★★★★★from 500+ reviews onG2GartnerVS CodeChrome
★★★★★

Best report of integration and API tests I've seen — which we don't get from RestAssured.

G2
★★★★★

Future of microservices testing. I don't write tests now!

G2 · 5/5
★★★★★

An amazing product that simplifies the automation.

Gartner · 4.0
XGitHubSlackYouTubeLinkedIn
Built by developers, for developers.Let's build the future, together.