Scripts run in the CLI omit certain visualizations seen in the Live UI. For this reason, we recommend that developers who are new to Pixie begin by using the Live UI.
Pixie needs to be installed on your Kubernetes cluster. If it is not already installed, please consult our install guides.
Run the following command to list all of Pixie's open source scripts.
px run -l # list pre-built scripts
You can run any PxL script using:
px run <script_name> # run a pxl script
Let's try run Pixie's
px run px/namespaces # run the pre-built px/namespace script
This script outputs two tables. The first table lists the namespaces on the current cluster and their pod and service counts. The second table lists the high-level resource consumption by namespace.
If Pixie is installed on multiple clusters, Pixie will use the cluster in the current kubectl context. To specify a different cluster, pass the
cluster_ID with the
px get viziers # display cluster IDs for all clusters with Pixie installedpx run <script_name> -c <cluster_ID> # run a script on a specific cluster
To show a the input arguments for any PxL script:
px run <script_name> -- --help # show the arguments for a script.px run <script_name> -- --arg_name val # pass arguments to a script
px/namespace script gives a top-level summary of the pods and services for a specific namespace. This script takes two arguments. If you don't provide arguments, the script will output an empty table (Pixie will soon enforce required arguments).
px run px/namespace -- --help # show the arguments for a script.px run px/namespace -- --namespace pl # pl is the namespace that Pixie is installed to (by default)
This script outputs three tables and the output is difficult to view in the terminal.
For scripts with verbose output (like the
px/namespace script you ran above), we recommend the following ways of interacting with the output.
csv output using the
-o flag, making it easy to consume the script's output using other CLI tools.
px run <script_name> -o csv > table_data.csv # output in csv format and redirect to a filepx run <script_name> -o json | jq # output in json format and pipe to jq
The Live CLI provides interactive views for output tables. To run the Live CLI, use
px live instead of
px live <script_name> # run a script using the Live CLIpx live px/namespace -- --namespace pl # run Pixie's px/namespace script
px/namespace script outputs three tables, one per tab at the bottom left of the terminal window.
You can interact with the Live CLI output:
PxL has support for building visualizations (graphs, charts, etc), which can be viewed in Pixie's Live UI. A link to the Live UI view of a particular script is included in each script output in the CLI.
The Live UI link appears at the bottom of the output of any
px run <script_name> output.
And at the top of the Live CLI output.
To learn how to use Pixie for a specific use case, check out one of the following tutorials:
To learn how to write custom PxL scripts, check out this tutorial.
To run your own PxL script using the CLI, use the
-f flag to provide the script's filename.
px run -f <script.pxl> # Use Pixie's CLI to run the pxl script with the provided filenamepx live -f <script.pxl> # Use Pixie's Live CLI to run the pxl script with the provided filename
Pixie offers end-to-end encryption for telemetry data requested by the CLI. For more information, see the FAQ.
Encryption is controlled by the
--e2e_encryption flag during script execution. Enabling E2E encryption adds some overhead to encrypt the results on the Vizier side and decrypt it on the CLI side.
# Enable encryption when running a script with the CLI.px run <script_name> --e2e_encryption# Disable encryption when running a script with the CLI.px run <script_name> --e2e_encryption=false
Use the following commands to show the status of Pixie on your cluster:
px get viziers # shows the registered K8s clusters that are running Pixie and their current statuspx get pems # shows the current status of the Pixie Edge Modules. Also, usable as `px run px/agent_status`px collect-logs # collect Pixie logs on the cluster
To view all available Pixie CLI commands: