Fix NGINX Propagation
Redeploy after NGINX Fix
Redeploy After Saving #
Saving the file does not update the running gateway. You must apply the ConfigMap and restart the deployment so NGINX loads the new config.
Run the following:
bash
cd ~/workshop/context-propagation
kubectl apply -f deploy/k8s/gateway-config.yaml
kubectl -n cosmic-shop rollout restart deployment/gateway
kubectl -n cosmic-shop rollout status deployment/gateway --timeout=180sVerify the pod picked up your changes:
bash
kubectl -n cosmic-shop exec deploy/gateway -- grep traceparent /etc/nginx/conf.d/default.conftext
proxy_set_header traceparent $http_traceparent;Validation Checklist #
Run these commands after redeploy completes.
1. Confirm gateway pod restarted #
bash
kubectl -n cosmic-shop rollout status deployment/gateway
kubectl -n cosmic-shop get pods -l app=gatewaytext
deployment "gateway" successfully rolled out
NAME READY STATUS RESTARTS AGE
gateway-xxxxxxxxxx-xxxxx 1/1 Running 0 30sAGE should be recent (pod was recreated after config change).
2. Confirm ConfigMap contains trace headers #
bash
kubectl -n cosmic-shop get configmap gateway-nginx-config -o yaml | grep traceparenttext
proxy_set_header traceparent $http_traceparent;You should see traceparent, tracestate, and baggage in the output.
3. Confirm traceparent reaches order-api #
Send a request through the edge gateway with a known trace header:
bash
kubectl -n cosmic-shop port-forward svc/gateway 8888:80 &
sleep 2
TRACE_ID="deadbeefdeadbeefdeadbeefdeadbeef"
curl -s -H "traceparent: 00-${TRACE_ID}-deadc0dedeadbeef-01" \
-X POST http://localhost:8888/api/orders \
-H "Content-Type: application/json" \
-d '{"productId":"eyepiece-plossl-set","quantity":1,"customerEmail":"trace-test@cosmic.shop"}' \
| python3 -m json.tool
kill %1 2>/dev/nulljson
{
"message": "Order created",
"order": { "orderId": "ORD-...", ... },
"traceHint": {
"traceId": "deadbeefdeadbeefdeadbeefdeadbeef",
...
}
}The traceHint.traceId should match the trace ID you sent in the traceparent header - confirming the gateway forwarded it to order-api.
Troubleshooting #
Here’s some of the potential issues you may encounter in this step & suggested remediation steps.
