- Tools
- StreamNative CLI (snctl)
snctl Quick Reference
This page contains a list of commonly used snctl
commands and flags.
snctl
autocomplete
BASH
source <(snctl completion bash) # set up autocomplete in bash into the current shell, bash-completion package should be installed first.
echo "source <(snctl completion bash)" >> ~/.bashrc # add autocomplete permanently to your bash shell.
You can also use a shorthand alias for snctl that also works with completion:
alias sn=snctl
complete -o default -F \_\_start_snctl sn
ZSH
source <(snctl completion zsh) # set up autocomplete in zsh into the current shell
echo '[[ $commands[snctl] ]] && source <(snctl completion zsh)' >> ~/.zshrc # add autocomplete permanently to your zsh shell
snctl
apply
apply
manages resources through files defining StreamNative Cloud resources. It creates and updates StreamNative Cloud resources through running snctl apply
. This is recommended way of managing StreamNative Cloud resources in production.
Creating and updating resources
The manifests of StreamNative Cloud resources can be defined in YAML or JSON. The file extension .yaml
, .yml
, and .json
can be used.
snctl apply -f ./my-manifest.yaml # create resource(s)
snctl apply -f ./my1.yaml -f ./my2.yaml # create from multiple files
snctl apply -f ./dir # create resource(s) in all manifest files in dir
# Create multiple resource(s) from stdin
snctl apply -f - <<EOF
apiVersion: cloud.streamnative.io/v1alpha1
kind: User
metadata:
name: [email protected]
namespace: myorg
spec:
email: [email protected]
name:
first: John
last: Doe
type: external
---
apiVersion: cloud.streamnative.io/v1alpha1
kind: RoleBinding
metadata:
name: [email protected]
namespace: myorg
spec:
roleRef:
apiGroup: cloud.streamnative.io
kind: Role
name: admin
subjects:
- apiGroup: cloud.streamnative.io
kind: User
name: [email protected]
EOF
Viewing and finding resources
snctl get pulsarclusters # List all pulsar clusters in the organization
snctl get pulsarclusters mycluster # List a particular pulsar cluster
snctl get puslarclusters mycluster -o yaml # Get the manifest of a pulsar cluster
# Describe commands with verbose output
snctl describe pulsarcluster mycluster
# List Pulsar Clusters Sorted by Creation Time
snctl get pulsarclusters --sort-by=.metadata.creationTimestamp
# Show labels for all clusters (or any other StreamNative Cloud object that supports labelling)
snctl get pulsarclusters --show-labels
# Get the Pulsar Clusters with label app=myapp
snctl get pulsarclusters --selector=app=myapp
# Check which Pulsar Clusters are ready and their locations with custom-columns
snctl get pulsarclusters -o custom-columns='CLUSTER NAME:.metadata.name,LOCATION:.spec.location,STATUS:.status.conditions[?(@.type=="Ready")].status'
Deleting resources
snctl delete -f ./sa.yaml # Delete a service account using the type and name specified in sa.yaml
snctl delete pulsarcluster unwanted --now # Delete a pulsar cluster with no grace period
snctl delete user,rolebinding baz foo # Delete user and rolebinding with same names "baz" and "foo"
snctl delete user,rolebinding -l name=myLabel # Delete usersand rolebindings with label name=myLabel
Resource types
List all supported resource types along with their shortnames, API group, whether they are namespaced (organizational scoped), and kind.
snctl api-resources