CICD-153 · Test service endpoints exist
Encyclopedia · Kubernetes fundamentals · All snippets
Previous · CICD-152 · Next · CICD-154
1. Where it fits
- Placement Bash run step following checkout, or equivalent lab terminal.
- Prerequisites isolated Kubernetes namespace, kubectl and reviewed manifests.
- Platforms kubernetes, local-lab.
2. Copy the snippet
bash
kubectl -n staging get endpointslices -l kubernetes.io/service-name=web -o json | jq -e '[.items[].endpoints[] | select(.conditions.ready == true)] | length > 0'3. How it works
The expression filters or transforms the input JSON. Where jq -e is used, a false or empty result can fail the gate.
4. Verify the result
Compare selectors and readiness if no EndpointSlices are ready.
Validation syntax-validated (Bash parse). Status definitions.