Skip to main content

KuebeROS Command Line Tool

Project description

KubeROS Command Line Tool

This repo contains the cli tools for users to interact with KubeROS platform.

Installation

There are three methods to install the cli tool.

1. Install in local path

KubeROS CLI tool depends only on the following common packages, it should not cause the compatibility problem with other packages.

  • argcomplete
  • PyYAML
  • requests
  • tabulate

Required python version: python >= 3.8

# install python3-pip
sudo apt update
sudo apt install python3-pip

Optional 1: install this system-wide

The python packages will be installed in /usr/lib/python3/dist-packages

The kuberos script will be installed in /usr/local/bin

# Instal KubeROS CLI
sudo pip install --system kuberos-cli
# enable autocompletion
activate-global-python-argcomplete

Opotion 2: using the default User Scheme

The packages are installed in ~/.local/lib/python3/

The executable scripts are in ~/.local/bin

In this case, you have to add the ~/.local/bin to the $PATH

# Instal KubeROS CLI
pip install kuberos-cli

# export ~/.local/bin to $PATH in .bashrc or .bash_profile
echo 'export PATH=$PATH:~/.local/bin' >> ~/.bashrc
source ~/.bashrc

# enable autocompletion
activate-global-python-argcomplete

2. Install in Virtual Environment (Venv)

You can install this CLI tool in an isolated Python environment with venv to avoid interfering with other projects due to dependencies.

Create a Venv and add the venv/bin to $PATH

sudo apt update
sudo apt install python3-venv

# create a virtual environment
cd <work directory>
python3 -m venv kuberos_cli_venv

# add the kuberos_cli_venv/bin to PATH
cd kuberos_cli_venv/bin
pwd # get the absolute path <local-bin-path-in-venv>

# replace the <local-bin-path-in-venv> with the path printed above 
# add it to .bashrc, or another profile depending on the terminal tool you are using
echo 'export PATH=$PATH:<local-bin-path-in-venv>' >> ~/.bashrc

Install kuberos-cli with pip:

pip install kuberos-cli
# enable autocompletion gobally
activate-global-python-argcomplete

3. From source (For Development)

git clone https://github.com/kuberos-io/kuberos-cli.git
cd kuberos-cli
pip install -r requirements.txt
# build it (optional)
python3 -m build
pip3 install -U .
# enable arg auto completion
eval "$(register-python-argcomplete kuberos)"
# override the python path to use the library from source
echo $PYTHONPATH=$PYTHONPATH:<path-to-source-code> # e.g. ~/ws/kuberos-cli

Usage

This CLI tool follows the conventions of the ROS2 CLI and uses the following style.

kuberos <command_group> <command> [name] [-args]

You can get the help for each command group with kuberos <command_group> -h or just type kuberos <command_group>.

For example, to deploy, check and delete deployments, you can use following commands:

# Create a deployment 
kuberos deploy create -f <path-to-deployment-manifest>
# List all deployments
kuberos deploy list
# Get the deployment status 
kuberos deploy info <deployment-name> 
# Delete a deployment
kuberos deploy delete <deployment-name>

Examples

Get the cluster status using kuberos cluster info -s -u <cluster-name>.

Cluster Name: kube
API Server: https://<api-server>:6443
Alive Age: 1 month, 1 week
Since Last Sync: 0 minutes

Robot Onboard Computers
--------------------------------------------------------------------------------
ROBOT_NAME    HOSTNAME        DEVICE_GROUP    IS_ALIVE    AVAILABLE    FLEET    PERIPHERALS
simbot-2      kube-simbot-02  simbot-pc       True        False        xx       ['rs-d435']
simbot-1      kube-simbot-01  simbot-pc       True        False        xx       ['rs-d435']

Edge Nodes
--------------------------------------------------------------------------------
HOSTNAME             GROUP    SHARED RESOURCE    IS_ALIVE    AVAILABLE    REACHABLE
kube-edge-worker-02  public   True               True        True         True
kube-edge-worker-01  public   True               True        True         True
kube-edge-worker-03  public   True               True        True         True
kube-edge-worker-04  public   True               True        True         True
kube-storage         storage  True               True        True         True

Control Plane Nodes
--------------------------------------------------------------------------------
HOSTNAME     ROLE           REGISTERED    IS_ALIVE    AVAILABLE    REACHABLE
kube-master  control_plane  True          True        False        True

Resource Usages
--------------------------------------------------------------------------------
HOSTNAME             CPU (Cores)    Memory (Gb)        Storage (Gb)
kube-edge-worker-02  0.04/4 (0.9%)  1.99/8.1 (24.4%)   N/A/40.5
kube-master          0.12/4 (3.0%)  4.37/8.1 (53.7%)   N/A/12.3
kube-simbot-02       0.06/4 (1.5%)  3.77/8.1 (46.4%)   N/A/40.5
kube-edge-worker-01  0.04/8 (0.5%)  3.98/16.4 (24.3%)  N/A/50.6
kube-simbot-01       0.04/8 (0.4%)  2.81/16.4 (17.1%)  N/A/50.6
kube-edge-worker-03  0.04/8 (0.5%)  3.46/16.4 (21.1%)  N/A/40.5
kube-edge-worker-04  0.04/8 (0.5%)  3.10/16.4 (18.9%)  N/A/50.6
kube-storage         0.03/4 (0.7%)  2.94/8.1 (36.1%)   N/A/203.1

For example, check the status of the target fleet before deploying a new application with kuberos fleet info example-fleet.

Fleet Name: example-fleet
Healthy: True
Fleet status: idle
Alive Age: 15 hours, 14 minutes
Main Cluster: kube
Description: Test fleet
Created since: 15 hours, 14 minutes
========================================
Robot Name      Id  Hostname        Computer Group    Reachable    Status      Shared Resource
simbot-1         1  kube-simbot-01  simbot-pc         True         deployable  False
simbot-2         2  kube-simbot-02  simbot-pc         True         deployable  False

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kuberos-cli-0.0.1.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

kuberos_cli-0.0.1-py3-none-any.whl (32.6 kB view details)

Uploaded Python 3

File details

Details for the file kuberos-cli-0.0.1.tar.gz.

File metadata

  • Download URL: kuberos-cli-0.0.1.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for kuberos-cli-0.0.1.tar.gz
Algorithm Hash digest
SHA256 1de2adf5deb8d405dc4cf0210e266c4f3ddc6da6d4823e08b156553a898710ac
MD5 23209d3b3c05db74925983d790c61ff8
BLAKE2b-256 6f863eb6a739e65fc41341c0cadfb931fd14b89b1d22b10c37b617f3ac097dec

See more details on using hashes here.

File details

Details for the file kuberos_cli-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: kuberos_cli-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 32.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for kuberos_cli-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cf3988c0cc737a528091111fad06c10793ddb1f31f33c375162da2eaa55944fc
MD5 1df134a5da34ca30a1a3579868703a3c
BLAKE2b-256 d0f43b7c70f82b1053cc7733cd9c40640bef6993ef17904d1bdeea023282fbd0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page