# kubectl krew install: Usage, Options & Common CI Errors

> kubectl krew install adds kubectl plugins from the krew index. Installing plugins on a fresh runner, PATH setup, and the network and re-run errors in CI.

Source: https://latchkey.dev/learn/command-reference/krew-install  
Updated: 2026-06-25

Install kubectl plugins on a runner from the krew index.

kubectl krew is the plugin manager for kubectl, and krew install adds plugins (kubectl ctx, kubectl ns, kubectl neat) from its index. On a fresh CI runner you install the plugins your scripts call in a setup step.

## What it does

kubectl krew install NAME downloads a plugin from the krew-index and drops its binary under the krew bin directory, making it available as kubectl NAME. krew update refreshes the index; krew list shows what is installed. krew itself is installed once, then plugins layer on top.

## Common usage

```Terminal
kubectl krew update
kubectl krew install ctx ns
kubectl krew install neat
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
kubectl ns my-namespace
```

## Common errors in CI

"kubectl: \"NAME\" is not a kubectl command" after installing means the krew bin dir is not on PATH - export ${KREW_ROOT:-$HOME/.krew}/bin into PATH in the same shell. Fresh runners have no plugins and an empty index, so run krew update before install or you get "plugin NAME does not exist". Installs hit GitHub over the network, so they fail in air-gapped CI unless the plugins are vendored, and an unpinned plugin can change behaviour build-to-build - pin to a known plugin version where the index allows. A cached krew home from a prior job may already have the plugin; krew install on an installed plugin errors, so guard with krew list.

## Using this in CI

A runner has no kubeconfig, no cached context, and no interactive auth. Every kubectl invocation in CI needs the context supplied explicitly, and most confusing CI failures here are the command running against the wrong cluster or no cluster at all.

```Terminal
# never rely on the ambient context on a runner
kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" get pods

# confirm what you are actually connected to before mutating anything
kubectl config current-context
kubectl cluster-info

# fail fast instead of hanging on an unreachable API server
kubectl --request-timeout=30s get nodes
```

> Always set `--request-timeout` in CI. Without it an unreachable API server hangs until the job times out, which turns a thirty-second failure into a twenty-minute one.

## FAQ

### kubectl krew install: Usage, Options & Common CI Errors?

kubectl krew is the plugin manager for kubectl, and krew install adds plugins (kubectl ctx, kubectl ns, kubectl neat) from its index. On a fresh CI runner you install the plugins your scripts call in a setup step.

### What it does?

kubectl krew install NAME downloads a plugin from the krew-index and drops its binary under the krew bin directory, making it available as kubectl NAME. krew update refreshes the index; krew list shows what is installed. krew itself is installed once, then plugins layer on top.

### Common errors in CI?

"kubectl: \"NAME\" is not a kubectl command" after installing means the krew bin dir is not on PATH - export ${KREW_ROOT:-$HOME/.krew}/bin into PATH in the same shell. Fresh runners have no plugins and an empty index, so run krew update before install or you get "plugin NAME does not exist".

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
