How to Use the KomoCLI </>

Komodor CLI is your go-to solution for streamlining Kubernetes management. Developed by Komodor, it offers a user-friendly command-line interface packed with features to simplify resource management, troubleshooting, and monitoring within Kubernetes clusters. Whether you're a seasoned pro or new to Kubernetes, Komodor CLI promises to revolutionise your workflow, making it easier than ever to navigate and optimise your infrastructure. Join us as we explore how Komodor CLI empowers users to efficiently manage their Kubernetes clusters with ease.

Step 1: Installation

Prerequisites:

Installation:

Mac/Linux (Recommended):
 

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/komodorio/komocli/HEAD/scripts/install.sh)"

 

Windows (PowerShell):
 

Invoke-Expression (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/komodorio/komocli/HEAD/scripts/install.ps1").Content

 

Homebrew (Mac):
 

brew tap komodorio/komocli && brew install komocli

 

Manual Installation:
- Download the latest release of Komocli from the GitHub releases page.
- Extract the downloaded archive to a location of your choice.
- Make sure the komocli executable is added to your system's PATH.

Step 2: Configuration

Authentication:

Komocli integrates with your existing kubectl configuration and Komodor platform access. No separate login command is required - authentication is handled through your kubectl context and Komodor platform credentials.

Step 3: Usage

Available Commands:

To see all available commands, run:

komocli --help

1. Port Forwarding:

Forward local port to a pod. Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted. If there are multiple pods matching the criteria, a pod will be selected automatically.

Basic Usage:

komocli port-forward pod/mypod 5000 --namespace default --cluster my-cluster --token=...

Examples:

  • Listen on port 5000 locally, forwarding data to/from port 5000 in the pod:
komocli port-forward pod/mypod 5000 --namespace default --cluster my-cluster --token=...
  • Listen on port 5000 locally, forwarding data to/from port 5000 in a pod selected by the deployment:
komocli port-forward deployment/mydeployment 5000 --namespace default --cluster my-cluster --token=...
  • Listen on port 8888 locally, forwarding to 5000 in the pod:
komocli port-forward pod/mypod 8888:5000 --namespace default --cluster my-cluster --token=...
  • Listen on port 8888 on all addresses, forwarding to 5000 in the pod:
komocli port-forward --address 0.0.0.0 pod/mypod 8888:5000 --namespace default --cluster my-cluster --token=...
  • Listen on a random port locally, forwarding to 5000 in the pod:
komocli port-forward pod/mypod :5000 --namespace default --cluster my-cluster --token=...

Available Flags:

  • --address string - Network address to listen on (default "localhost")
  • --browser - Open forwarded address automatically in browser
  • --cluster string - Komodor cluster name that contains resource
  • --namespace string - Namespace for the resource (default "default")
  • --timeout duration - Timeout for operations (default 5s)
  • --token string - JWT Authentication token

2. Help and Version:

  • Get help for any command:
komocli help
komocli <command> --help
  • Check version:
komocli --version
  • Show verbose debug information and logging:
komocli --verbose

Komodor Port Forwarding 

From the UI:

  • Select the Pod you wish to Port Forward with.
  • Select the Local Port to forward with.
  • Select the Port.
  • Run the command created in the pop-up, as above. 

Step 3: Updating

  • To update Komocli to the latest version, download the new release from GitHub and replace the existing executable.

Step 4: Troubleshooting

If you encounter any issues or errors, refer to the troubleshooting section of the Komodor CLI documentation or seek help from Komodor Support.

By following these steps, you should be able to effectively use the Komodor CLI to manage your Kubernetes resources and gain insights into your cluster's operations.

Was this article helpful?

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.