πŸ• Learn how to configure k9s

Learn the basics about configuring k9s

Under the hood

K9s leverages XDG to keep its configuration files under $XDG_CONFIG_HOME/k9s. The default configuration will vary across operating system so be sure to read up on the default location if you choose not to set that environment variable. The main configuration file is named config.yaml and stores various K9s specific bits.

For information on the default locations for your OS please see this link. If you are still confused a quick k9s info will reveal where k9s is loading its configurations from.

UnixMacOSWindows
~/.config/k9s~/Library/Application Support/k9s%LOCALAPPDATA%\k9s

Alternatively, you can set K9S_CONFIG_DIR to tell k9s the directory location to pull its configurations from.

k9s CLI configuration

OptionComment / DescriptionDefault
liveViewAutoRefreshEnable periodic refresh of resource browser windows.false
refreshRateRepresents ui poll intervals.2s
maxConnRetryNumber of retries once the connection to the api-server is lost.15
readOnlySpecifies if modification commands like delete/kill/edit are disabled.false
noExitOnCtrlCToggles whether k9s should exit when CTRL-C is pressed.false
ui.enableMouseEnable mouse support.false
ui.headlessSet to true to hide K9s header.false
ui.logolessSet to true to hide K9s logo.false
ui.crumbslessSet to true to hide K9s crumbs.false
ui.reactiveToggles reactive UI.false
ui.noIconsToggles icons / emoji display as not all terminal support these charsfalse
skipLatestRevCheckToggles whether k9s should check for the latest revision from the Github repository releases.false
disablePodCountingDisable count pods while in node view.false
shellPod.imageThe shell pod image to usebusybox:1.35.0
shellPod.namespaceThe namespace to launch to shell pod intodefault
shellPod.limits.cpuCPU limit on the shell pod100m
shellPod.limits.memoryMemory limit on the shell pod100Mi
shellPod.ttyEnable TTYtrue
imageScans.enableEnables image scansfalse
imageScans.exclusions.namespacesList of namespaces to exclude
imageScans.exclusions.labelsKey-Value pairs of labels to exclude

@TODO: rewrite/reformat/etc

OptionComment / DescriptionDefault
logger.tailDefines the number of lines to return100
logger.bufferDefines the total number of log lines to allow in the view1000
logger.sinceSecondsRepresents how far to go back in the log timeline in seconds-1
logger.fullScreenGo full screen while displaying logs.false
logger.textWrapToggles log line wrap.false
logger.showTimeToggles log line timestamp info.false
thresholds.cpu.criticalGlobal memory/cpu thresholds. When set will alert when thresholds are met.
thresholds.cpu.warnGlobal memory/cpu thresholds. When set will alert when thresholds are met.
thresholds.memory.criticalGlobal memory/cpu thresholds. When set will alert when thresholds are met.
thresholds.memory.warnGlobal memory/cpu thresholds. When set will alert when thresholds are met.

Example config file

# $XDG_HOME/k9s/config.yaml
# File will be autogenerated with all the default fixins if not found in the config specification.
k9s:
  # Enable periodic refresh of resource browser windows. Default false
  liveViewAutoRefresh: false
  # Represents ui poll intervals. Default 2secs
  refreshRate: 2
  # Number of retries once the connection to the api-server is lost. Default 15.
  maxConnRetry: 5
  # Specifies if modification commands like delete/kill/edit are disabled. Default is false
  readOnly: false
  # Toggles whether k9s should exit when CTRL-C is pressed. When set to true, you will need to exist k9s via the :quit command. Default is false.
  noExitOnCtrlC: false
  ui: # NOTE! [K9s v0.30.0]
    # Enable mouse support. Default false
    enableMouse: false
    # Set to true to hide K9s header. Default false
    headless: false
    # Set to true to hide K9s logo. Default false
    logoless: false
    # Set to true to hide K9s crumbs. Default false
    crumbsless: false
    # Toggles reactive UI. This option provide for watching on disk artifacts changes and update the UI live  Defaults to false.
    reactive: false
    # Toggles icons display as not all terminal support these chars.
    noIcons: false
  # Toggles whether k9s should check for the latest revision from the Github repository releases. Default is false.
  skipLatestRevCheck: false
  # Disable count pods while in node view. Default is false.
  disablePodCounting: false
  # ShellPod configuration applies to all your clusters
  shellPod:
    # The shell pod image to use.
    image: busybox:1.35.0
    # The namespace to launch to shell pod into.
    namespace: default
    # The resource limit to set on the shell pod.
    limits:
      cpu: 100m
      memory: 100Mi
    # Enable TTY
    tty: true
  # ImageScan config changed from v0.29.0!
  imageScans:
    enable: false
    # Exclusions excludes namespaces or specific workload labels
    exclusions:
      # Exclude the following namespaces for image vulscans!
      namespaces:
        - kube-system
        - fred
      # Exclude pods with the following labels from image vulscans!
      labels:
        k8s-app:
          - kindnet
          - bozo
        env:
          - dev
  # Logs configuration
  logger:
    # Defines the number of lines to return. Default 100
    tail: 100
    # Defines the total number of log lines to allow in the view. Default 1000
    buffer: 5000
    # Represents how far to go back in the log timeline in seconds. Setting to -1 will tail logs. Default is -1.
    sinceSeconds: 300
    # Go full screen while displaying logs. Default false
    fullScreen: false
    # Toggles log line wrap. Default false
    textWrap: false
    # Toggles log line timestamp info. Default false
    showTime: false
  # Global memory/cpu thresholds. When set will alert when thresholds are met.
  thresholds:
    cpu:
      critical: 90
      warn: 70
    memory:
      critical: 90
      warn: 70
Last modified January 20, 2025: docs: Add docs for plugins (3d1971b)