Kubernetes Service endpoint testing¶
Kubernetes service endpoint testing involves verifying the connectivity and behavior of services running within a cluster. After deploying an application, checking the external IP orPorts is necessary to ensure the service is reachable^[400-devops-06-kubernetes-k8s-learning-08-collect-readme.md].
Local Verification¶
To interact with a service directly from a local machine, kubectl port-forward can be used to map a local port to the service's port.^[400-devops-06-kubernetes-k8s-learning-08-collect-readme.md]
[kubectl port-forward](<./kubectl-port-forward.md>) service/svc-myapp 8080:80 --address 0.0.0.0
Traffic Validation¶
Once the port forwarding is active, curl can be utilized to send requests to localhost and verify the response^[400-devops-06-kubernetes-k8s-learning-08-collect-readme.md].
curl localhost:8000
For deployments utilizing multiple replicas (such as a rollout with versions v1 and v2), sending repeated requests allows for the observation of load balancing behavior^[400-devops-06-kubernetes-k8s-learning-08-collect-readme.md]. This is typically demonstrated using a loop to generate multiple requests, confirming that traffic is distributed across the different pods^[400-devops-06-kubernetes-k8s-learning-08-collect-readme.md].
Related¶
- kubectl
- [[Services]]
- [[Load balancing]]
Sources¶
- 400-devops-06-kubernetes-k8s-learning-08-collect-readme.md