A kubectl plugin for connecting to BEAM (Erlang VM) nodes running in Kubernetes pods.
make installThis installs the plugin to ~/.local/bin/kubectl-beam. Make sure ~/.local/bin is in your PATH.
Copy the kubectl-beam script to any directory in your PATH:
cp kubectl-beam /usr/local/bin/
chmod +x /usr/local/bin/kubectl-beamkubectl beam --versionkubectlconfigured and connected to a Kubernetes cluster- For IEx shells: Elixir installed locally
- For Erlang shells: Erlang/OTP installed locally
- For Observer mode: Erlang/OTP with wx support
Note: For IEx remote shells, your local Erlang/Elixir versions should match the deployed pod versions to avoid compatibility issues. The erl command is more forgiving with version mismatches.
Connect to a pod using IEx:
kubectl beam iex my-app-podConnect to a pod in a specific namespace:
kubectl beam iex -n production my-app-podConnect using Erlang shell:
kubectl beam erl my-app-podStart the Erlang Observer GUI connected to a remote node:
kubectl beam iex --observer -n production my-app-podThis launches the Observer application locally, allowing you to inspect processes, memory usage, and other runtime metrics on the remote node.
Use long names instead of short names:
kubectl beam iex -l my-app-podSpecify an explicit cookie:
kubectl beam iex --cookie mysecretcookie my-app-podSpecify a custom cookie path on the pod:
kubectl beam iex --cookie-path /app/config/.erlang.cookie my-app-podSpecify a cookie from a custom environment variable:
kubectl beam iex --cookie-env MY_COOKIE_VAR my-app-podConnect to a specific container in a multi-container pod:
kubectl beam iex -c app-container my-app-podThe plugin establishes a connection to remote BEAM nodes by:
- Port-forwarding EPMD (port 4369) and Erlang distribution ports (9100-9109) from the pod to localhost
- Automatically detecting or accepting a specified Erlang cookie
- Configuring local DNS resolution to map the pod IP to localhost
- Starting a local hidden BEAM node that connects to the remote node via
--remsh
This approach provides full terminal support because the shell runs locally while communicating with the remote node through the port-forward tunnel.
The plugin attempts to detect the Erlang cookie in the following order:
- Explicitly provided via
--cookieflag - From a custom path via
--cookie-pathflag - From environment variables (tried in order):
$RELEASE_COOKIE$ERLANG_COOKIE$COOKIE
- From common file paths:
/opt/app/releases/COOKIE/app/releases/COOKIE/opt/release/COOKIE/release/COOKIE~/.erlang.cookie/root/.erlang.cookie
| Flag | Description | Default |
|---|---|---|
-n, --namespace |
Kubernetes namespace | default |
-c, --container |
Container name (for multi-container pods) | |
--observer |
Start Observer GUI | false |
-l, --long-names |
Use long names | false |
--cookie |
Explicit Erlang cookie | Auto-detected |
--cookie-path |
Path to cookie file on pod | |
--cookie-env |
Environment variable containing cookie | RELEASE_COOKIE |
If the plugin cannot automatically detect the cookie, specify it explicitly:
kubectl beam iex --cookie yourcookie my-app-podOr specify the path where the cookie is stored:
kubectl beam iex --cookie-path /custom/path/to/.erlang.cookie my-app-podEnsure no other processes are using ports 4369 or 9100-9109 on your local machine.
If multiple BEAM nodes are running in the same pod, set the NODE_BASENAME environment variable in your pod to specify which node to connect to.
If Observer mode fails with an error about wx, ensure your local Erlang installation includes wx support:
erl -noshell -eval 'wx:new(), init:stop()'The examples/ directory contains minimal Erlang and Elixir applications demonstrating both short names (sname) and long names (name) for testing kubectl-beam.
# Setup local test environment with kind
./examples/setup-local.sh
# Connect to test pods
kubectl beam erl erlang-app-sname --cookie test_cookie_secret
kubectl beam iex elixir-app-name --cookie test_cookie_secret -lSee examples/README.md for detailed information about short names vs long names and testing.
Install bats-core and run the test suite:
brew install bats-core # macOS
# or
apt-get install bats # Debian/Ubuntu
# Unit tests (no cluster required)
make test
# Integration tests (requires deployed test pods)
make test-integration
# All tests
make test-allCopyright 2026 Dairon Medina Caro me@dairon.org
Licensed under the Apache License, Version 2.0. See LICENSE file for details.