PxL scripts can be run in Pixie's web based Live UI or CLI tool. To learn about the Live UI, check out this tutorial.
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'spx/namespaces
script:
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 -c
flag.
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
Pixie's 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.
Pixie supports json
and 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 run
.
px live <script_name> # run a script using the Live CLIpx live px/namespace -- --namespace pl # run Pixie's px/namespace script
The 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:
ctrl+enter
or ctrl+click
.ctrl+v
. ctrl+k
.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 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
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 thier 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:
px --help