lbcli Command Returns an Error

Descriptionlbcl Returns an ErrorVersion: 2.x
Symptoms

Run the command:

lbcli <command> (e.g: lbcli get cluster)

Command output:

rpc error: code = Unauthenticated desc = no valid authentication header: Request unauthenticated with bearer

Root CauseMissing JWT configuration.
Resolution

There are a few resolution methods:

Method #1:

  1. Copy the lightos_jwt file from the Ansible server (by default the file will be stored in the /root/ folder to the Lightbits servers).
  2. Run the command source lightos_jwt.

This will set the JWT string to an environment variable called “LIGHTOS_JWT”.

  1. Run lbcli commands by adding “-J $LIGHTOS_JWT” to the command parameters.

Method #2:

  1. Copy the JWT string from the lightos_jwt file on the Ansible server (the string after “export LIGHTOS_JWT=”).
  2. Add the following line to the /etc/lbcli/lbcli.yaml file:

jwt: <The JWT string copied in #1 above>.

  1. Save the modified file.
  2. Now you can use the lbcli without the “-J” flag.

Method #3:

  1. Copy the JWT string from the lightos_jwt file on the Ansible server (the part after “export LIGHTOS_JWT=”).
  2. You can use the lbcli with the “-J” flag, followed by the string copied from item #1 above.
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard