Cloud Native 12 min read

How to Run Declarative Performance Tests on Kubernetes with YAML

This article explains how to define and execute performance testing workflows for Kubernetes using declarative YAML files, covering the design of custom CRDs, task orchestration, example manifests, and the implementation of core operations and monitoring.

Alibaba Cloud Native
Alibaba Cloud Native
Alibaba Cloud Native
How to Run Declarative Performance Tests on Kubernetes with YAML

Performance testing is a routine need in development to gauge service behavior, but traditional script‑based approaches become costly when scenarios grow complex. Leveraging cloud‑native principles, the article shows how to express performance test workflows entirely in YAML, avoiding custom code.

Workflow Definition

Two YAML files illustrate the approach:

performance-test.yaml defines a Beidou custom resource that creates a namespace, starts monitoring deployment creation efficiency, repeats a workload deployment creation step, and finally deletes the namespace.

basic-1-pod-deployment.yaml provides the workload template for a simple Nginx deployment with resource limits.

Running the test is as simple as invoking the Beidou CLI:

$ beidou server -c ~/.kube/config services/performance-test.yaml

The output includes per‑deployment creation latency, the 95th‑percentile (TP95) of total creation time, and success rates, exported in Prometheus format for Grafana visualization.

Why Declarative YAML?

Traditional performance or regression testing requires writing and maintaining code for each atomic operation (e.g., create deployment, wait for readiness). By encapsulating these operations as primitives (plugins) and describing the flow in YAML, teams achieve reusable, low‑maintenance test definitions that can be shared across projects.

The article compares this model to existing declarative tools such as Ansible, SaltStack, Argo Workflow, and clusterloader2, noting that the presented approach offers finer‑grained control at the operation level.

Service Design

The service is delivered as a single binary or Operator and provides built‑in primitives for common Kubernetes actions (CreateNamespace, DeleteNamespace, PrepareBatchDeployments, etc.) and observability tasks (DeploymentCreationEfficiency, PodCreationEfficiency). Users write YAML that references these primitives, optionally using control statements like RepeatNTimes for loops.

Core Implementation

The core is a Kubernetes Custom Resource Definition (CRD) named Beidou. Its spec contains steps (ordered tasks) and references (reusable sub‑workflows). The Go implementation includes:

Data structures for Beidou, BeidouSpec, BeidouStep, BeidouOperation, and BeidouArg.

Execution engine functions ExecSteps, ExecOperation, ExecTask, and ExecTaskWithRefer that dispatch tasks based on their type and handle monitoring.

Example operation implementations, such as PodAnnotations, demonstrate how plugins interact with the Kubernetes client to validate pod state.

Practical Use

The Alibaba Cloud Container Service team has deployed an early version internally for performance and regression testing, reporting significant efficiency gains. The article encourages readers to adopt similar declarative patterns for repetitive cloud‑native tasks.

For further reading, references to Ansible, SaltStack, Argo Workflow, and clusterloader2 are provided.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Cloud NativeKubernetesYAMLDeclarativeCustom Resource
Alibaba Cloud Native
Written by

Alibaba Cloud Native

We publish cloud-native tech news, curate in-depth content, host regular events and live streams, and share Alibaba product and user case studies. Join us to explore and share the cloud-native insights you need.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.