Skip to main content
LocalOps CLI ops can be used to get shell access to the underlying Kubernetes cluster of an environment.
LocalOps CLI

Usage:
  ops [command]

Available Commands:
  completion        Generate the autocompletion script for the specified shell
  help              Help about any command
  login             Login to LocalOps Account
  logout            Logout of LocalOps Account
  update-kubeconfig Update current context to environment Kubernetes cluster
  version           LocalOps CLI Version

Flags:
  -h, --help   help for ops

Use "ops [command] --help" for more information about a command.
To get shell access, you need to
  1. Login to your LocalOps account
  2. Use ops CLI to set Kubernetes context of kubectl CLI to point at the environment’s Kubernetes cluster.
  3. Then use kubectl to inspect the cluster.

Login to LocalOps

Login to LocalOps account using your email address.
ops login

Set kubernetes context

Use this commnd updates your local current context to point at the environment’s kubernetes cluster.
ops update-kubeconfig -e env-id
To get env-id, visit your environment dashboard and see “Shell” tab.

Use Kubectl

After update-kubeconfig command succeeds, you can use any kubectl command to inspect pods, deployments, jobs and everything else running in your LocalOps environment. All your services are deployed in the app-services namespace. To see only your service pods:
kubectl get pods -n app-services
To see all cluster resources across all namespaces:
kubectl get all --all-namespaces

Monitor pods with k9s

k9s is a terminal-based UI that makes it easy to monitor and manage Kubernetes resources. After setting up your kubeconfig with ops update-kubeconfig, simply launch k9s:
k9s
k9s will automatically use the current Kubernetes context set by ops update-kubeconfig. To launch k9s directly in the app-services namespace where your services run:
k9s -n app-services
From the k9s interface you can:
  • View all pods and their status in real time
  • Watch logs by selecting a pod and pressing l
  • Filter resources by namespace using / to search
  • Delete, describe, or edit resources interactively
Install k9s via Homebrew with brew install derailed/k9s/k9s on macOS, or see the k9s installation guide for other platforms.

Shell into a pod

To get a shell inside a running pod, first identify the pod name in the app-services namespace:
kubectl get pods -n app-services
Then exec into the pod:
kubectl exec -it <pod-name> -n app-services -- /bin/sh
Some containers may use /bin/bash instead of /bin/sh. If /bin/sh fails, try /bin/bash.
You can also use k9s to get a shell — select a pod and press s to open a shell session directly.