💁 Kubectl wrapper with variables. Run commands without pasting ids.
Changes since last stable release (1.6):
#
) are no longer send to the underlying kubectl
(#12, #13)Many thanks to @walfie for the changes! 🥇
Complete changelog since the previous release: https://github.com/Mikulas/kubectl-repl/compare/1.6...1.7
This release is also available as a Docker image: https://hub.docker.com/r/mikulas/kubectl-repl/
Changes since last stable release (1.4):
context
and namespace
options in the final bash command
kubectl
such as kubectl --namespace=default plugin-name
. This was however incompatible with kubectl plugins (see https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/).kubectl plugin-name --namespace=default
.A practical example of a kubectl plugin is an executable named kubectl-old
somewhere in your $PATH
such as this:
#!/usr/bin/env bash
set -eu
kubectl get "$@" --sort-by=.metadata.creationTimestamp
That allows you to call kubectl old pods
(get pods sorted by creation time) in addition to the original kubectl get pods
(sorted by name). In kubectl-repl, this of course simplifies to invoking old pods
.
Note the the plugin cannot be called kubectl-get-sorted
for example, because the builtin commands cannot be overshadowed even when the longest executable filename rule would take place.
Complete changelog since the previous release: https://github.com/Mikulas/kubectl-repl/compare/1.4...1.6
This release is also available as a Docker image: https://hub.docker.com/r/mikulas/kubectl-repl/
recalled
Changes since last stable release (1.1):
$var:index
, eg $1:2` to access the second column of first variable.$var
still works (and will always work). It defaults to $var:1
.--all-namespaces
which puts namespace on the first column and unique resource name on the second column.# beta kube-system get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
$1 kube-monitoring logspout-ds-9l4pw 1/1 Running 36 4d
$2 kube-monitoring logspout-ds-b2pws 1/1 Running 9 3d
$3 kube-monitoring logspout-ds-gs4nv 1/1 Running 0 4d
# beta kube-system ; echo $1
kube-monitoring
# beta kube-system ; echo $1:2
logspout-ds-9l4pw
-context=string
flag was introduced, which passed the context to all invoked kubectl
commands. This greatly simplifies managing multiple clusters: an operator can have multiple shells opened at once with different contexts../kubectl-repl -context=beta
kubectl
, but namespace selector communicated directly with the cluster through the golang SDK. In 2830fe35ab8a5c43d6e9243257abca1876ab4454 this was refactored to also use kubectl
. This solves many issues, including authentication and state persistence with KUBECONFIG
.--help
.Complete changelog since the previous release: https://github.com/Mikulas/kubectl-repl/compare/1.1...1.4
This release is also available as a Docker image: https://hub.docker.com/r/mikulas/kubectl-repl/
resolved issues:
-context=string
flag was introduced, which passed the context to all invoked kubectl
commands. This greatly simplifies managing multiple clusters: an operator can have multiple shells opened at once with different contexts../kubectl-repl -context=beta
kubectl
, but namespace selector communicated directly with the cluster through the golang SDK. In 2830fe35ab8a5c43d6e9243257abca1876ab4454 this was refactored to also use kubectl
. This solves many issues, including authentication and state persistence with KUBECONFIG
.This is a botched release with broken features, removed
removed dynamic watch mode introduced in alpha 1
added support for KUBECONFIG
env variable
:
). The first part sets path to kube config (defaults to $HOME/.kube/config
). The other part overrides current context.KUBECONFIG="$PROJECT/kubecfg.yaml:prod"
use context prod
defined in custom configWrapper for kubectl-repl
with context as inline parameter:
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
if [[ $# -ne 1 ]]; then
echo "Usage: $0 context"
exit 1
fi
CTX="$1"
export KUBECONFIG="$HOME/.kube/config:$CTX"
rlwrap kubectl-repl
dynamic watch mode
if machine output is detected (json, yaml), lines are not prefixed and saved to variables
similarity matching fixes
resolved issues:
kubectl
- Thanks to /u/preflightsiren~/.kube
instead of .kops
No changes were made to the REPL itself.
Complete changelog since the previous release: https://github.com/Mikulas/kubectl-repl/compare/1.0...1.1
This release is also available as a Docker container: https://hub.docker.com/r/mikulas/kubectl-repl/
resolved issues:
--watch
and --follow
#6exec -it
) #7^C
) now only kills invoked process, not whole repl-version
flagWhile version 1.0 is considered stable, it's feature set is not fixed and will evolve. REPL should only be used for interactive work, not in scripts. For that, either use kubernetes api directly or kubectl yaml/json output.
Complete changelog since the previous release: https://github.com/Mikulas/kubectl-repl/compare/0.2...1.0
This release is also available as a Docker container: https://hub.docker.com/r/mikulas/kubectl-repl/
resolved issues:
new features:
Complete changelog since the previous release: https://github.com/Mikulas/kubectl-repl/compare/0.1...0.2
This release is also available as a Docker container: https://hub.docker.com/r/mikulas/kubectl-repl/