AWS re:Invent happy hour: Dec 1, 6 PM PST at MGM Grand RSVP

A gold service tile beside two trays lights up two tiles in one tray, illustrating how a scope change can cover an extra workload.

Assign Kubernetes Services to DLP Group Rules


You want to mask the customer field in captured checkout traffic. The payments team already has a DLP group rule that masks that field, so you open Add to DLP rule on the checkout service. The preview shows one more workload. The orders service running next to checkout would also start masking customer.

You can reproduce that decision with the orders app in mock-lab’s Kubernetes tutorial. You’ll run the same app in three workload locations, see why the rule would expand, then save a scoped copy and check fresh captures from all three. Watch the Feature Spotlight

1. Deploy the mock-lab orders demo

Use a dedicated test Speedscale account and Kubernetes cluster. You’ll need Git, kubectl, permission to create namespaces and deployments, and admin access to the Speedscale dashboard. The cluster should already have a connected Speedscale forwarder with Redact sensitive data on and the standard operator configured for eBPF capture in both exercise namespaces. The demo pulls published container images and the orders app calls the hosted demo catalog. Install the Kubernetes operator · Configure eBPF capture · Configure the forwarder baseline

Start a Bash shell. Replace speedscale-dlp-test with your test kubeconfig context and check the displayed cluster before applying anything. Use a test cluster where dlp-payments and dlp-shop are available for this exercise. Run the rest of the terminal commands from the mock-lab repository root in that shell.

export DLP_CONTEXT='speedscale-dlp-test'
kubectl config get-contexts "$DLP_CONTEXT"

git clone https://github.com/speedscale/mock-lab.git
cd mock-lab

for namespace in dlp-payments dlp-shop; do
  kubectl kustomize tutorial/k8s/overlays/go |
    sed -e "s/^  name: tutorial$/  name: $namespace/" \
        -e "s/^  namespace: tutorial$/  namespace: $namespace/" |
    kubectl --context "$DLP_CONTEXT" apply -f -
done

sed -e 's/tutorial-orders/checkout/g' \
    -e 's#image: checkout#image: ghcr.io/speedscale/mock-lab-tutorial-go:latest#' \
    tutorial/k8s/base/app.yaml |
  kubectl --context "$DLP_CONTEXT" -n dlp-shop apply -f -

kubectl --context "$DLP_CONTEXT" -n dlp-payments rollout status deploy/tutorial-orders --timeout=4m
kubectl --context "$DLP_CONTEXT" -n dlp-shop rollout status deploy/tutorial-orders --timeout=4m
kubectl --context "$DLP_CONTEXT" -n dlp-shop rollout status deploy/checkout --timeout=4m

The overlay creates an orders deployment and Postgres in each namespace. The last apply reuses the same app as checkout and points it at the Postgres service already running in dlp-shop. Renaming the deployment, its Service, selector, and pod app label gives Speedscale a distinct service to assign. These are the three workloads you’ll compare.

NamespacePod app labelRole in the exercise
dlp-paymentstutorial-ordersAlready covered by the payments rule
dlp-shopcheckoutThe service you want to add
dlp-shoptutorial-ordersThe extra workload the preview will find
LLM prompt for this step
Read the mock-lab tutorial/k8s README and this article's deployment commands. Use only my approved test kubeconfig context <test-context> and test Speedscale account. Show the context and cluster before applying anything. Ensure the dlp-payments and dlp-shop namespace names are free. From the mock-lab root, render and deploy the Go tutorial overlay in both namespaces. Reuse the app manifest to deploy checkout in dlp-shop with its own app label and Service. Verify all three app rollouts and report the namespace and app label for each. Leave the context and clone location available for the following steps.

2. Capture the synthetic orders

Enable eBPF capture for the three app deployments. Speedscale uses the deployment annotation to attach capture to the workloads. In this setup the jobs send HTTP requests from inside the cluster to the three Services.

kubectl --context "$DLP_CONTEXT" -n dlp-payments annotate deploy/tutorial-orders \
  capture.speedscale.com/enabled=true --overwrite
kubectl --context "$DLP_CONTEXT" -n dlp-shop annotate deploy/tutorial-orders deploy/checkout \
  capture.speedscale.com/enabled=true --overwrite

send_orders() {
  local namespace="$1" service="$2" job
  job=$(
    sed -e "s/^  namespace: tutorial$/  namespace: $namespace/" \
        -e "s/tutorial-orders/$service/g" tutorial/k8s/traffic/job.yaml |
      kubectl --context "$DLP_CONTEXT" create -f - -o name
  ) || return
  kubectl --context "$DLP_CONTEXT" -n "$namespace" \
    wait --for=condition=complete "$job" --timeout=5m &&
  kubectl --context "$DLP_CONTEXT" -n "$namespace" logs "$job" -c traffic
}

send_orders dlp-payments tutorial-orders
send_orders dlp-shop tutorial-orders
send_orders dlp-shop checkout

Each Job should log sent 135 requests, 0 unexpected. That confirms the requests made it through. Check capture separately in Infrastructure and Traffic in Speedscale. Find the three locations and open a fresh inbound POST /orders request from each. The synthetic customer value, such as ada@example.com, should be visible in the captured request body before you add the lab rule. If an existing policy already masks that field, use a clean test account for this comparison.

LLM prompt for this step
In the same mock-lab clone and approved test context, annotate the three app deployments for eBPF capture and run the article's send_orders function once per workload. Report each Job's completion status and traffic count. In the approved Speedscale dashboard, check for a fresh inbound POST /orders per workload and confirm the synthetic customer field is visible before the lab rule. Keep the DLP_CONTEXT value and send_orders function for the post-save run. Report any missing capture or existing mask before proceeding.

3. Create the starting DLP group rule

In DLP Rules, create dlp-lab-payments. Under Scope, select Group rule, enter Payments as the Owner, and set Clusters to your test cluster’s name as displayed in Speedscale. Set Namespaces to dlp-payments and Services to tutorial-orders. Under Mask fields by name, enter customer in Field or header name and click Add. Turn on Enabled in Scope, then save. Leave the cluster’s Redaction rule setting in Infrastructure unchanged. The group rule applies when the workload matches its scope. Dashboard rule setup · Masking by field name

A rule save reloads the forwarders connected to the account and can pause capture briefly. Wait for the test cluster’s forwarder to come back before generating traffic for verification. The DLP rules section on the service page shows the baseline and any matching group rules for each location. On checkout, the payments rule should be absent at this point. How saved rules take effect

4. Check what else the scope would cover

Open Services, select checkout, and click Add to DLP rule in the DLP rules section. Under Where, keep the test cluster and dlp-shop selected. Under Rule, choose dlp-lab-payments.

The preview shows + dlp-shop under Namespaces and + checkout under Services. Under Also masks, look for tutorial-orders in dlp-shop. The rule checks each list independently. One listed namespace and one listed service must match, so adding dlp-shop gives every service already listed another place to match. If checkout later starts running in dlp-payments, the widened rule would match it there too.

Save choicedlp-payments / tutorial-ordersdlp-shop / checkoutdlp-shop / tutorial-orders
Add to dlp-lab-paymentsOriginal ruleOriginal ruleOriginal rule
Create a copy for checkoutOriginal ruleScoped copyBaseline only

Add to dlp-lab-payments is selected by default. For this exercise, select Create a copy that covers only checkout, leave the copy name as dlp-lab-payments-checkout, and create it. The copy carries over the masking and owner, with the scope set to the selected checkout location. If the preview says a location could not be checked, resolve that before choosing to widen the original. How group-rule scope matches workloads

5. Verify masking on fresh captures

Confirm the copy appears under DLP rules on checkout and the original rule still covers dlp-payments / tutorial-orders. After the forwarder comes back, rerun the traffic jobs from the same Bash shell.

send_orders dlp-payments tutorial-orders
send_orders dlp-shop checkout
send_orders dlp-shop tutorial-orders

In Traffic, select a time range after the save. Filter to an inbound POST /orders from each workload and compare its captured request body. Look for a REDACTED- token in customer for checkout and dlp-payments / tutorial-orders. The same field in dlp-shop / tutorial-orders should still contain the synthetic value. Comparing a newly masked request with a fresh out-of-scope request tells you more than the rule’s saved settings alone. Inspect captured request bodies

LLM prompt for the scope and verification steps
Use my approved test Speedscale dashboard and the three mock-lab workloads. Follow the article to create the enabled dlp-lab-payments group rule with owner Payments, the test cluster, namespace dlp-payments, service tutorial-orders, and the customer mask. From checkout, choose Add to DLP rule and report the two added scope values and the exact workload under Also masks. Choose the scoped copy for checkout and verify both saved scopes. When the forwarder is back, use the existing send_orders function in the mock-lab root for all three workloads. Inspect recent inbound POST /orders captures and report which customer values were masked and whether the out-of-scope order remained visible. Keep all changes in the test account and report any unavailable check.

Clean up the lab

In the test dashboard, turn off both lab rules and save before deleting them. Disabling delivers the change to the forwarder. Deleting alone does not trigger a reload. Remove the two namespaces you created after you finish reviewing the captures.

kubectl --context "$DLP_CONTEXT" delete namespace dlp-payments dlp-shop
LLM prompt for cleanup
Clean up this exercise in the same approved test account and Kubernetes context. Disable and save only dlp-lab-payments and dlp-lab-payments-checkout before deleting them. Confirm dlp-payments and dlp-shop are the namespaces created for this run, remove them, and report what was removed or remains.

For your next scope change, start from a service and use Also masks to decide whether to extend the existing policy or save a copy. If you need to design the baseline and group rules first, start with Team-Based DLP and see how those rules affect traffic replay and testing.

Frequently asked questions

Why does adding one service to a DLP group rule sometimes mask another workload?

The rule matches one value in each of its cluster, namespace, and service lists. Adding a namespace gives the services already listed another place to match. Also masks shows the extra running workloads the dashboard finds.

Does copying a DLP group rule change the original?

The copy keeps the owner's name and the original rule's masking settings at the time of the copy. It has its own scope and can be edited independently. The original keeps its existing scope.

Do I need admin access to assign a service?

Yes. Speedscale admins can use Add to DLP rule and save the change. Other signed-in users can view the rules that match a service.

Can I verify a rule change against traffic captured earlier?

Use traffic captured after the forwarder reloads. The earlier capture reflects the rule configuration in effect when it was recorded.

Capture and replay your production traffic

Speedscale records live traffic from your Kubernetes services and turns it into tests, mocks, and load tests. Run it yourself, or have our AI agents and engineers run it for you.