Skip to content

Kubernetes pod verification and testing

Pod verification and testing in Kubernetes involves a workflow of building container images, deploying them, and confirming operational status through both CLI commands and network requests^[400-devops-07-monitoring-and-observability-k8s-istio-samples-bookinfo-readme.md].

Verification Workflow

To verify a deployment, such as the bookinfo sample application, the first step is to apply the appropriate Kubernetes configuration files^[400-devops-07-monitoring-and-observability-k8s-istio-samples-bookinfo-readme.md].

[kubectl](<./kubectl.md>) apply -f samples/bookinfo/platform/kube/bookinfo.yaml

Checking Pod Status

After deploying, you should wait for all pods to reach the Running state^[400-devops-07-monitoring-and-observability-k8s-istio-samples-bookinfo-readme.md]. You can verify the status of all pods using the get pods command^[400-devops-07-monitoring-and-observability-k8s-istio-samples-bookinfo-readme.md].

[kubectl get pods](<./kubectl-get-pods.md>)

The output should list all relevant pods (e.g., details-v1, productpage-v1, ratings-v1) showing a status of Running and the expected readiness (e.g., 2/2 or 1/1)^[400-devops-07-monitoring-and-observability-k8s-istio-samples-bookinfo-readme.md].

Functional Testing

CLI Execution

Once pods are running, functional testing can be performed by executing commands inside specific containers^[400-devops-07-monitoring-and-observability-k8s-istio-samples-bookinfo-readme.md]. For example, to verify connectivity within the cluster, you can exec into a ratings Pod and curl the productpage service^[400-devops-07-monitoring-and-observability-k8s-istio-samples-bookinfo-readme.md].

[kubectl](<./kubectl.md>) exec -it "$([kubectl](<./kubectl.md>) get [Pod](<./pod.md>) -l app=ratings -o jsonpath='{.items[0].metadata.name}')" -c ratings -- curl productpage:9080/productpage | grep -o "<title>.*</title>"

A successful response will return the expected HTML title, such as <title>Simple Bookstore App</title>^[400-devops-07-monitoring-and-observability-k8s-istio-samples-bookinfo-readme.md].

Browser Access

Alternatively, the application can be verified externally by accessing the service via a browser using the appropriate NodePort or external IP^[400-devops-07-monitoring-and-observability-k8s-istio-samples-bookinfo-readme.md].

Sources

^[400-devops-07-monitoring-and-observability-k8s-istio-samples-bookinfo-readme.md]