Skip to main content
With mocli, you can manage your mogenius clusters, browse Kubernetes resources, stream logs, and set up port-forwarding — all from your terminal. The CLI includes an interactive Terminal UI (TUI) that provides k9s-style navigation without requiring a local kubeconfig. Authentication is handled through the mogenius platform, giving you secure access to any connected cluster from anywhere.

Installation

Mac, Linux

Use homebrew to install mocli:
On Linux with a headless machine, mocli requires a browser for the initial login. After the first login, your session persists locally.

Windows

Getting Started

You need a mogenius account to use mocli. If you don’t have one yet, sign up here.

Login

Run the following command to authenticate. Your browser will open automatically to complete the login:
Your session is stored locally, so you only need to log in once per machine.

Terminal UI

Launch the interactive TUI to browse and manage your resources:
The TUI provides a visual interface for navigating your mogenius organization, clusters, and Kubernetes resources. All keybindings are displayed at the bottom of each screen. The TUI follows a hierarchical navigation pattern: Organization → Cluster → Namespace → Resources

Browsing Resources

Once you select a namespace, you’ll see a list of Pods by default. Use command mode (:) to switch between resource types:
  • :pods or :po — Pods
  • :deployments or :deploy — Deployments
  • :services or :svc — Services
  • :statefulsets or :sts — StatefulSets
  • :daemonsets or :ds — DaemonSets
  • :jobs — Jobs
  • :cronjobs or :cj — CronJobs
  • :configmaps or :cm — ConfigMaps
  • :secrets — Secrets
  • :ingresses or :ing — Ingresses
The TUI also supports custom resources (CRDs) — type the resource name in command mode to browse any resource type available in your cluster.

Viewing Logs

Select a Pod and press Enter to view its logs in real-time. If the Pod has multiple containers, you’ll be prompted to select one.

Port Forwarding

From the logs view or resource list, press t to create a port-forward tunnel to the selected Pod. Enter the port mapping (e.g., 8080:80) and the tunnel will be established. Active tunnels persist while the TUI is running. Press Esc from the port-forward view to return to browsing while keeping tunnels open.

Shell Access

Select a Pod and press x to open an interactive shell session in the container. If the Pod has multiple containers, you’ll be prompted to select one. The shell session is tunnelled through the mogenius platform — no local kubeconfig or direct cluster access required.

CLI Commands

In addition to the TUI, mocli provides kubectl-style CLI commands for scripting and automation.

Context Management

Before using resource commands, set up your context to specify which organization, cluster, and namespace to target:
The context is stored locally and used by all resource commands. You can override it per-command with --org, --cluster, or -n flags.

Listing and Getting Resources

mocli list is an alias for mocli get when listing all resources of a kind:

Creating Resources

Create resources from manifest files or directly via CLI:

Applying Resources

Apply a manifest with create-or-update semantics — resources that don’t exist yet are created, and resources that already exist are updated in place. Applying the same manifest twice is safe (idempotent):
Unlike mocli create, which fails when a resource already exists, mocli apply reconciles the cluster to match your manifest — making it the safer choice for repeatable deployments and CI/CD pipelines.

Deleting Resources

Shell Access

Open an interactive shell in a running container:
mocli exec is an alias for mocli shell.

Viewing Logs (CLI)

Stream or fetch logs from pods and jobs:

Waiting for Conditions

Wait for a resource to reach a specific condition — useful in CI/CD pipelines:
Supported conditions:
  • condition=complete — Job completed successfully
  • condition=failed — Job failed
  • condition=ready — Pod is ready
  • delete — Resource has been deleted

Authentication

CI/CD Integration: For automated pipelines, create an API key in your mogenius profile settings. The API key is a single opaque token starting with mo_pat:. Set the MOGENIUS_API_KEY environment variable and mocli automatically uses API key authentication.

Cluster Management

Shell Autocompletion

mocli can complete commands, flags, and even live resource names, namespaces, and kinds directly in your shell. The quickest way is to let mocli detect your shell and set everything up automatically:
This adds a source line to your shell’s config file (~/.zshrc, ~/.bashrc) or writes a completion file for fish (~/.config/fish/completions/). The command is idempotent — running it twice does nothing. Restart your shell or re-source the config file to activate it. To set it up manually, generate the completion script for your shell:
Autocompletion is dynamic: when you tab-complete a resource name, namespace, or kind, mocli queries your active context live — so you get the real names from your cluster, not just static command names.

Connecting a Cluster

You can use the CLI to install the mogenius operator on your Kubernetes cluster:
  1. Run the connect command:
  2. Select an organization
  3. Create a new cluster entry or select an existing one
  4. Confirm to deploy the operator
The operator will be deployed to your cluster via Helm. Verify the connection through the mogenius UI or by running mocli config list to see your available clusters.

Port Forwarding (CLI)

Use the CLI to create secure TCP tunnels to Kubernetes workloads without direct cluster access:
Supported resource kinds: Pod, Service, Deployment, StatefulSet, DaemonSet Examples:
The tunnel remains active while the CLI process runs. Press Ctrl+C to terminate. For detailed usage and options, see Tunnels.