Using the st2 CLI

The StackStorm web interface is useful if we want to get familiar with the product, but, if you are going to use StackStorm in production, you need to learn the CLI commands. Now, perform the following steps to access the st2 CLI from the pod:

  1. Find the st2 client's pod name:
$ export ST2CLIENT=$(kubectl get --namespace stackstorm pod -l app=st2client -o jsonpath="{.items[0].metadata.name}")
  1. Execute the following commands via the st2 CLI. This command will execute the st2 --version command from the pod:
$ kubectl exec -it ${ST2CLIENT} -n stackstorm -- st2 --version
st2 3.2dev (a643ba7), on Python 2.7.12
  1. Authenticate to StackStorm using the following CLI command and save the password using the -w parameter. If you don't want to save the password, then you can remove the -w parameter at the end: 
$ kubectl exec -it ${ST2CLIENT} -n stackstorm -- st2 login st2admin -p 'Ch@ngeMe' -w
Logged in as st2admin
  1. List the available actions from the core pack:
$ kubectl exec -it ${ST2CLIENT} -n stackstorm -- st2 action list --pack=core
  1. List the actions from the core pack. You can also try the other pack options for Linux, ChatOps, and packs:
$ kubectl exec -it ${ST2CLIENT} -n stackstorm -- st2 action list --pack=core

All StackStorm CLI operations are available via REST API, Python, and JavaScript bindings. You can find more information at the StackStorm CLI and Python Client reference link in the See also section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.10.1