Testing in Kubernetes at pull request (PR) time is essential, but it can be complex. Shared staging environments introduce risks of test collisions, flakiness, and resource contention. For teams moving fast and shipping often, confidence in each merge matters, and ephemeral, isolated environments are key.
Testkube can run complete test suites in ephemeral preview environments like vClusters, which allows teams to validate new features or patches in isolated, production-like clusters. It runs directly from the GitHub Actions pipeline to enable accurate, automated testing of every feature branch in isolated environments, without the overhead of managing infrastructure. It retains logs, artifacts, and results, even after environments are gone from any on-prem or cloud-managed Kubernetes cluster.
Most teams rely on a shared staging environment for integration testing. While this can work early on, it quickly breaks down as teams scale or test complexity grows.
Key issues include:
You need a way to run automated tests for every feature branch in clean, isolated, and cost-efficient environments, without managing infrastructure.
Acts as the CI/CD trigger. When a pull request is opened or updated, GitHub Actions kicks off the pipeline. This orchestrates provisioning the virtual cluster, deploying the application, and running automated tests.
Testkube is a cloud-native test orchestration platform that runs any kind of tests from inside your Kubernetes Clusters. Testkube uses custom resources (CRDs) to define test executions and integrates seamlessly with both GitOps tools and traditional CI/CD pipelines for centralized test scheduling, observability and analytics.
Testkube’s multi-agent architecture makes it easy to deploy lightweight Runner Agents into ephemeral Kubernetes clusters for running tests to validate both infrastructure and application functionality.
Testkube uses the concept of Test Workflows to define how to execute your tests, which includes advanced functionality like parallelisation, sharding, dependencies and test composition.
vCluster spins up lightweight, virtual Kubernetes clusters within a namespace on a host cluster (like GKE). Each vCluster has its own API server and control plane components, providing complete isolation for workloads, RBAC, and namespaces, ideal for spinning up short-lived, production-like environments for every PR without the cost or overhead of full clusters.
Provides the physical Kubernetes infrastructure to run host clusters. GKE offers autoscaling, high availability, and enterprise-grade Kubernetes features, making it a reliable foundation for running multiple vClusters in parallel with efficient resource utilization.
With Testkube's capability to integrate with CI/CD like GitHub Actions and run on virtual clusters like vClusters on a cloud-managed cluster, here is the workflow that can automate the complete process.
Let us understand each step of this workflow that runs when a PR is raised against the `main` branch.
As mentioned above, Testkube uses Test Workflows to define how to run any kind of test from inside your Kubernetes clusters. The Test Workflow being run in this example (step 10 above) is a simple curl test to validate the availability of the application under test:
YAML
kind: TestWorkflow
apiVersion: testworkflows.testkube.io/v1
metadata:
name: curl-nginx-app
namespace: testkube
spec:
config:
url:
type: string
container: {}
steps:
- name: Run curl
container:
image: curlimages/curl:8.7.1
shell: curl {{ config.url }}
status: {}
Read more about Test Workflows in the Testkube Documentation.
With Testkube, testing goes beyond pass/fail, it becomes a window into how your workloads behave under test conditions. Testkube integration with GitHub Actions sets up the first window to test execution for the entire team.
Testkube not just runs tests but also gives visibility into test behavior:
Note: Resource usage for a curl test was very low to record, hence added a snippet for a different test execution to demonstrate how Testkube can identify resource-heavy tests.
This enables teams to continuously refine their test coverage, adjust Kubernetes resource requests/limits, and improve deployment reliability, based on real data, not assumptions.
Ephemeral environments deliver value only when they are provisioned and torn down automatically, ensuring isolation, repeatability, and optimal resource utilization without overhead.
This setup ensures:
This architecture enables staging-grade testing for every pull request, without the complexity of managing dedicated staging environments. It brings together powerful cloud native components in a cohesive workflow:
For engineering teams scaling their development velocity, managing growing test complexity, or adopting GitOps practices, this setup provides a robust foundation for automated, reliable, and resource-efficient PR testing workflows.
Get started with Testkube now to have a GitOps testing machine that is highly configurable. By adopting this approach, teams can shift left on reliability, catch regressions earlier, and scale testing without scaling complexity.
Join the Testkube Slack community to start a conversation or read Testkube documentation to start building fault-tolerant, automated test pipelines tailored to the organisation’s infrastructure.
Testkube is a test execution and orchestration framework for Kubernetes that works with any CI/CD system and testing tool you need. It empowers teams to deliver on the promise of agile, efficient, and comprehensive testing programs by leveraging all the capabilities of K8s to eliminate CI/CD bottlenecks, perfecting your testing workflow. Get started with Testkube's free trial today.
Related topics: