Skip to content

CLI Reference

The kubetail CLI is the primary entry point for Kubetail on your desktop. You can use it to start the web dashboard, stream logs to your terminal or manage Kubetail resources in your cluster.

These flags are available on all commands:

FlagDefaultDescription
--kubeconfigPath to kubeconfig file
--in-clusterfalseUse in-cluster Kubernetes configuration
-c, --config~/.kubetail/config.yamlPath to config file

Start the dashboard server and open the web UI in your default browser.

Terminal window
kubetail serve [flags]

Flags

FlagDefaultDescription
-p, --port7500Port number to listen on
--hostlocalhostHost address to bind to
-l, --log-levelinfoLog level (debug, info, warn, error, disabled)
--skip-openfalseSkip opening the browser

Examples

Terminal window
# Start the dashboard (opens at http://localhost:7500)
kubetail serve
# Use a custom port
kubetail serve --port 8080
# Start without opening the browser
kubetail serve --skip-open

Fetch logs for a container or a set of workload containers.

Terminal window
kubetail logs [source1] [source2] ... [flags]

Sources

A source identifies which pods/containers to stream logs from. Sources use the following syntax:

[namespace:]<resource>[/name[/container]]
ExampleDescription
web-abc123Pod named web-abc123 in the default namespace
deployments/webweb deployment in the default namespace
deployments/*All deployments in the default namespace
deployments/web/container1Specific container in a deployment
deployments/web/*All containers in a deployment
frontend:web-abc123Pod in the frontend namespace
frontend:deployments/webDeployment in the frontend namespace

Multiple sources can be specified:

Terminal window
kubetail logs <source1> <source2>

Flags

FlagDefaultDescription
--kube-contextKubeconfig context to use
-h, --head[=N]10Return the first N records
-t, --tail[=N]10Return the last N records
--allfalseReturn all records
-f, --followfalseStream new records
--sinceInclude records from the specified point (inclusive)
--untilInclude records up to the specified point (inclusive)
--afterInclude records strictly after the specified point
--beforeInclude records strictly before the specified point
-g, --grepFilter records by a regular expression (requires --force)
--regionFilter source pods by region (comma-separated)
--zoneFilter source pods by zone (comma-separated)
--osFilter source pods by operating system (comma-separated)
--archFilter source pods by CPU architecture (comma-separated)
--nodeFilter source pods by node name (comma-separated)
--rawfalseOutput only raw log messages without metadata
--columnsSet output columns (overrides defaults)
--add-columnsAdd output columns to the defaults
--remove-columnsRemove output columns from the defaults
--with-cursorsfalseShow paging cursors
--hide-headerfalseHide table header
--all-containersfalseShow logs from all containers in a pod
--forcefalseForce command (required when using --grep)

The --columns, --add-columns, and --remove-columns flags accept a comma-separated list of column names: timestamp, dot, node, region, zone, os, arch, namespace, pod, container.

The --head, --tail, and --all flags are mutually exclusive. The --since and --after flags are mutually exclusive, as are --until and --before.

The --since, --until, --after, and --before flags accept:

  • An ISO 8601 timestamp (e.g. 2006-01-02T15:04:05Z07:00)
  • An ISO 8601 duration relative to now (e.g. PT30M for 30 minutes ago) — only for --since and --until

Default behavior: tail mode (last 10 records) unless --since is specified, in which case head mode is used.

Examples

Terminal window
# Tail the last 10 records from a pod
kubetail logs nginx
# Tail a deployment
kubetail logs deployments/web
# Follow new records
kubetail logs deployments/web --follow
# Return all records and follow
kubetail logs deployments/web --all --follow
# Return first 100 records
kubetail logs nginx --head=100
# Return records from the last 30 minutes
kubetail logs nginx --since PT30M --all
# Return records between two timestamps
kubetail logs nginx --since 2006-01-02T15:04:05Z --until 2007-01-02T15:04:05Z --all
# Filter by regex (requires --force)
kubetail logs nginx --grep "GET /about" --force
# Filter pods by region
kubetail logs deployments/web --region=us-east-1
# Output raw log messages only
kubetail logs nginx --raw

Manage Kubetail cluster resources using Helm under the hood (Helm does not need to be installed separately).

Terminal window
kubetail cluster <subcommand> [flags]

Create a new Kubetail release in the cluster.

Terminal window
kubetail cluster install [flags]

Flags

FlagDefaultDescription
--kube-contextName of the kubeconfig context to use

Examples

Terminal window
kubetail cluster install

Upgrade an existing Kubetail release to the latest chart version available locally.

Terminal window
kubetail cluster upgrade [flags]

Flags

FlagDefaultDescription
--kube-contextName of the kubeconfig context to use

Examples

Terminal window
kubetail cluster upgrade

Remove an existing Kubetail release from the cluster.

Terminal window
kubetail cluster uninstall [flags]

Flags

FlagDefaultDescription
--kube-contextName of the kubeconfig context to use

Examples

Terminal window
kubetail cluster uninstall

List currently installed Kubetail releases.

Terminal window
kubetail cluster list [flags]

Flags

FlagDefaultDescription
--kube-contextName of the kubeconfig context to use

Examples

Terminal window
kubetail cluster list

Manage Kubetail’s Helm chart repository (https://kubetail-org.github.io/helm-charts/).

Terminal window
kubetail cluster repo <subcommand>
SubcommandDescription
addAdd the Kubetail chart repository to Helm
updateUpdate the Kubetail chart repository in Helm
removeRemove the Kubetail chart repository from Helm

Examples

Terminal window
kubetail cluster repo add
kubetail cluster repo update
kubetail cluster repo remove

Manage the Kubetail CLI configuration.

Terminal window
kubetail config <subcommand>

Create a default configuration file.

Terminal window
kubetail config init [flags]

Flags

FlagDefaultDescription
--path~/.kubetail/config.yamlTarget path for the configuration file
--formatyamlConfiguration file format (yaml, json, toml)
--forcefalseOverwrite an existing configuration file

Examples

Terminal window
# Create default config at ~/.kubetail/config.yaml
kubetail config init
# Create config in JSON format
kubetail config init --format json
# Overwrite an existing config file
kubetail config init --force
# Write config to a custom path
kubetail config init --path /etc/kubetail/config.yaml

The CLI can be configured using a YAML (or JSON/TOML) config file. By default it is read from ~/.kubetail/config.yaml. Use kubetail config init to generate a default config file, or pass a custom path with the -c / --config global flag.

## Kubetail CLI Configuration File
#
# This file defines the behavior for the kubetail CLI tool,
# including logs command defaults and dashboard server settings.
#
## version ##
#
# Schema version for the configuration file
#
version: 1
## general ##
#
general:
## kubeconfig ##
#
# Path to the kubeconfig file to use for CLI requests.
# If empty, the default path (~/.kube/config) or KUBECONFIG env var is used.
#
# Default value: ""
#
kubeconfig: ""
## commands ##
#
commands:
## logs ##
#
# Settings specific to the 'logs' subcommand
#
logs:
## kube-context ##
#
# The specific Kubernetes context to use.
# If empty, the current active context is used.
#
# Default value: ""
#
kube-context: ""
## head ##
#
# The number of lines to show from the beginning of the log buffer
#
# Default value: 10
#
head: 10
## tail ##
#
# The number of lines to show from the end of the log buffer
#
# Default value: 10
#
tail: 10
## columns ##
#
# Full set of output columns for 'logs' records.
# Allowed values: timestamp,dot,node,region,zone,os,arch,namespace,pod, container
#
# Default value: ["timestamp", "dot"]
#
columns:
- timestamp
- dot
## serve ##
#
# Settings for the dashboard server
#
serve:
## host ##
#
# The network interface the server should bind to.
#
# Default value: localhost
#
host: localhost
## port ##
#
# The TCP port the server will listen on.
#
# Default value: 7500
#
port: 7500
## skip-open ##
#
# If true, the CLI will not automatically open the browser
# when the server starts.
#
# Default value: false
#
skip-open: false