End to End Testing in Kubernetes – Part II

In this blog post, I will show you how to write End to End Tests in Kubernetes to verify the various objects in a Kubernetes cluster like Pods, Services, Nodes, Namespaces etc.

I would highly recommend you to read my previous blog about End to End Testing in Kubernetes for context setting prior to looking at the below set of tests – 

End to End Testing in Kubernetes

Health Check
If you want to interact with the Kubernetes API, there is no need to write your own library. You can leverage a number of available client libraries for this purpose. I am using the Python API Client for Kubernetes to interact with the cluster in Cloud.

Official Python client library for Kubernetes –

Documentation for Kubernetes API Endpoints –

The below tests will verify the pod count and service count in the ‘default’ namespace —

The below test will iterate through all the namespaces in the K8s cluster and list it down –

The below set of tests will iterate through all the endpoints, services, nodes and pods in the K8s cluster and list them down —

The below tests lists pods and services for a specific namespace —

Using the Python API Client we saw how to interact with the K8s components in the cluster hosted in AWS or Azure. By running a set of End to End Tests we can easily determine the health of the cluster. We have just scratched the surface with these E2E Tests — you can improvise on top of these tests to interact with any K8s object in the cluster and verify functionalities.

Categories: Kubernetes

4 replies

  1. is there any python e2e test framework like e2e(ginkgo) in golang?


  1. End to End Testing in Kubernetes – dotnetvibes
  2. Crash Loop Detection in Kubernetes – dotnetvibes
  3. Kubernetes Architecture – dotnetvibes

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: