[
https://issues.apache.org/jira/browse/PHOENIX-8080?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andrew Kyle Purtell updated PHOENIX-8080:
-----------------------------------------
Summary: Pherf Harness: Phase 4: Kubernetes backend (was: Pherf Harness:
Phase 4)
> Pherf Harness: Phase 4: Kubernetes backend
> ------------------------------------------
>
> Key: PHOENIX-8080
> URL: https://issues.apache.org/jira/browse/PHOENIX-8080
> Project: Phoenix
> Issue Type: Sub-task
> Components: harness, pherf
> Reporter: Andrew Kyle Purtell
> Assignee: Andrew Kyle Purtell
> Priority: Major
> Fix For: PHOENIX-8070
>
>
> This subtask adds a Kubernetes execution backend to the harness under
> {{dev/harness}} and adds Kubernetes deployment support for the Distributed
> Pherf controller and agent fleet. A developer can validate a build, its
> workloads, and its deployment topology (including an optional service mesh)
> on a local k3d cluster, then promote the exact image digests recorded in a
> passing validation bundle to a container registry serving a shared cluster.
> The Kubernetes backend code in {{lib/backend/k8s.sh}} implements the full
> substrate contract using {{kubectl}}. Every {{kubectl}} command passes both
> the target context and the target namespace, and every resource query filters
> by the {{px.harness.cluster}} label carrying that context and namespace.
> Because the harness reads the target context from its own configuration
> rather than from the active context in the operator's kubeconfig, it cannot
> accidentally act against another cluster.
> The generator in {{k8s/manifests.gen.sh}} renders deployment manifests from
> templates. Every scalable service role is defined as a {{StatefulSet}} paired
> with a headless {{Service}} and the {{OnDelete}} update strategy, preserving
> stable network identities and persistent volumes while keeping pod
> replacement under harness control. Cluster formatting and bootstrap steps run
> as {{Jobs}}, and client and tooling containers run as standalone {{Pods}}.
> Pods receive Guaranteed QoS by pairing the memory limits and JVM heap
> parameters from the sizing tables with a CPU allocation of 250 millicores per
> GiB, and persistent storage is requested through {{volumeClaimTemplates}}
> against a configurable {{StorageClass}}, defaulting to {{local-path}} on k3d.
> Each pod renders its runtime configuration files from shared templates
> mounted via {{ConfigMaps}}.
> The preflight script in {{scripts/preflight-k8s.sh}} checks Kubernetes API
> compatibility, compares total resource requests against the allocatable
> capacity of the target nodes, checks active {{ResourceQuotas}} and the
> configured {{StorageClass}}. On k3d targets, preflight checks available
> Docker engine memory after subtracting a fixed k3s overhead allowance
> calibrated from peak memory usage in live test runs. During workload
> execution, the backend watches for container restarts, OOM kills, and
> unexpected exits. Any unplanned termination aborts the run and reports the
> prior termination state if the kubelet has already restarted the container. A
> hard kill action waits until pod status confirms termination so a following
> drain aware restart cannot target a pod that has already been replaced.
> Teardown fails closed if pointed at a namespace not owned by the harness.
> Running {{px-cluster down}} deletes only the owned namespace and persistent
> volume claims for that deployment, leaving the underlying k3d cluster intact
> unless the operator asks to remove it with {{px-cluster down --label
> k3d.cluster=px}} or {{px-k3d delete}}.
> External cluster deployments are configured through an out-of-repository
> target file referenced by {{PX_K8S_TARGET}}. This file specifies the kubectl
> context, namespace, container registry, pull secret, {{StorageClass}}, node
> selectors, tolerations, dedicated-node declaration, and mesh overlay toggle.
> To isolate faults and balance resource use, DataNodes, RegionServers, and
> Pherf agents declare preferred host anti-affinity so replicas spread across
> the selected worker nodes whenever capacity allows.
> Container image promotion is handled by {{px-cluster push BUNDLE}}, which
> publishes the exact image digests recorded in a verified validation bundle
> without building images, logging into registries, or creating secrets. The
> promotion gate accepts any bundle whose aggregate verdict maps to {{PASS}},
> {{SKIP}}, or {{ADVISORY}}, and rejects bundles with {{FAIL}},
> {{INCONCLUSIVE}}, {{ERROR}}, or unrecognized statuses.
> Local k3d cluster lifecycle management is handled by the {{px-k3d}} utility.
> Immutable digests in {{docker/versions.env}} pin the k3s runtime image along
> with the two k3d helper images.
> Performance measurement on Kubernetes follows the same scoping rules used on
> Compose. Timing verdicts are downgraded to {{ADVISORY}} only when justified
> by a busy host or by a resource bottleneck shown in the run's telemetry.
> After a workload finishes, a cluster resources check inspects captured
> telemetry for out-of-memory kills, full garbage collection pauses, and host
> CPU saturation. On Kubernetes, it also checks every non-RegionServer
> container against its container CPU limit so that CPU saturation in a Pherf
> agent demotes the timing verdict.
> An opt-in service mesh overlay is enabled by setting {{PX_K8S_MESH=1}}. Istio
> is the reference service mesh and must be installed by the operator. When
> active, the overlay applies sidecar injection labels to the namespace and
> adds role specific annotations to the workload groups. Batch {{Jobs}} disable
> sidecar injection so one-shot pods can exit cleanly on completion, and core
> HBase and Hadoop daemons remain uninjected unless the operator explicitly
> enables injection for them. Starting a meshed cluster requires a live sidecar
> injector. A preflight check named {{mesh_injector}} aborts if the target
> context does not have a live Istio sidecar injector, preventing a result
> bundle from claiming mesh execution when no mesh was running. When the
> injector check passes, the bundle manifest records the injector identity. All
> Kubernetes result bundles also record the cluster API version, pod placement
> topology, and resolved registry digests.
> Manifests for the Distributed Pherf tier are generated under
> {{groups/pherf}}. A {{ConfigMap}} named {{pherf-target}} defines the single
> ZooKeeper quorum used by the tier, whether that quorum is managed by the
> harness or hosted externally. The controller runs as a single replica
> {{Deployment}} mounting a persistent volume claim at its run directory,
> exposed through a {{ClusterIP}} {{Service}} on ports 8780 and 8790. The agent
> fleet runs as a Deployment with {{PX_PHERF_AGENT_COUNT}} replicas, where each
> agent uses its Kubernetes pod name as its unique agent ID. Host-side
> {{px-pherf}} CLI commands reach the controller REST API through a local
> loopback tunnel, and the {{pherf-distributed}} driver talks to the controller
> directly from inside its pod. Running {{px-pherf scale COUNT}} runs {{kubectl
> scale}} against the agent {{Deployment}} and waits until the target number of
> agents report the {{IDLE}} state.
> When the mesh overlay is enabled, controller and agent pods receive automatic
> sidecar injection without additional flags.
> Each pod mounts {{/tmp/px}} from its own persistent volume claim so that
> telemetry and collector artifacts written before a fault injection survive
> pod replacement. Once the harness copies a collector artifact into the local
> result bundle, it deletes the source file from the pod's persistent volume
> while leaving behind any file whose copy failed for postmortem inspection,
> which keeps persistent claims from accumulating stale data across runs.
> Operator documentation in {{docs/backends.md}} covers the k8s backend design,
> external target files, preflight checks, image promotion and its eligibility
> gate, the service mesh overlay and injector check, the {{px-k3d}} lifecycle
> tool, Kubernetes measurement scoping rules, the extended recovery bound,
> persistent {{/tmp/px}} volume claims, and the multi-node proof. The main
> harness README summarizes the day-to-day Kubernetes workflow.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)