Skip to main content

What is PX CLI

PX CLI is a unified command-line interface that provides secure, remote access to all Portworx services. It allows administrators to manage Portworx Enterprise and Portworx Backup clusters without requiring SSH access to nodes or the need to run kubectl exec into pods. By consolidating all Portworx management functionality into a single tool, PX CLI simplifies daily operations and troubleshooting.

Why use PX CLI

PX CLI bridges the gap between Kubernetes operations and Portworx management. It functions as a Kubernetes-native interface, using the same RBAC rules and credentials that already secure your environment. You can run it either as a standalone binary (px) or as a kubectl plugin (kubectl px), depending on your preferred workflow.

Because it communicates over a TLS-encrypted connection and integrates directly with Kubernetes authentication, PX CLI eliminates the need for SSH access. This approach improves security and simplifies remote troubleshooting. With PX CLI, you can review logs, inspect services, and perform administrative tasks without connecting to a node.

PX CLI supports both human-readable and machine-readable output formats. Whether you are reviewing results directly or integrating them into automation pipelines, you can easily switch between table, JSON, or YAML output using the -o flag.

PX CLI provides the following key benefits:

  • Secure, remote access to Portworx clusters
  • Native Kubernetes integration for authentication and RBAC
  • A single, extensible tool for managing all Portworx services

How PX CLI works

PX CLI provides a consistent management experience across Portworx Enterprise and Portworx Backup by dynamically discovering installed components. It scans your system PATH for binaries prefixed with px- and integrates them into its command structure.

When PX CLI finds the following binaries, it registers each as a subcommand of px:

  • px-pxe: Provides external Portworx Enterprise management
  • px-pxb: Connects to Portworx Backup
  • px-pxctl: Maintains compatibility with legacy pxctl

How PX CLI connects to your clusters

Each PX CLI component connects to a different Portworx service using a specific method based on how that service is deployed.

px pxe

This component connects to Portworx Enterprise and uses Kubernetes port forwarding to communicate with the cluster.

It authenticates using Kubernetes credentials from ~/.kube/config, locates the Portworx API service in the portworx namespace, and sets up a secure tunnel using kubectl port-forward. All communication occurs through this encrypted channel. SSH access to nodes is not required.

px pxctl

This component connects to Portworx Enterprise and provides legacy pxctl compatibility by executing commands inside Portworx pods.

It retrieves cluster information from the Kubernetes configuration (~/.kube/config) and locates a running Portworx pod in the cluster. PX CLI then uses kubectl exec to run pxctl commands inside the pod and returns the output. PX CLI manages pod selection automatically. If a pod is unavailable, it connects to an available pod. You can also use the --node flag to target a specific node's pod.

px pxb

This component connects to Portworx Backup and communicates with PX-Central using authenticated HTTPS API calls.

It reads the backup configuration from ~/.pxb/config, authenticates via OAuth 2.0, and manages access tokens automatically. PX CLI translates commands into secure API requests to the PX-Central or Portworx Backup endpoint, providing a consistent CLI experience for backup and restore operations.

The modular architecture of PX CLI enables centralized management of all Portworx services in a secure and consistent manner, without disrupting existing Kubernetes workflows.

note

Some px pxb commands support JSON and YAML file input through the --file flag. When using a file that contains multiple objects, only the first object is processed. Use separate files and run the command for each file.