Skip to main content

multiexec

Simple utility for running a kubectl exec across multiple Pods.

Usage

Call the script with your Pod filters (passed thru to kubectl get pods) and your command (passed thru to kubectl exec -it) as follows:

$ multiexec <POD FILTERS> -- <EXEC COMMAND>

pass --once-per-node to only run the command in a single Pod on each node

Examples

Say hello in every Pod on a given node

$ multiexec --all-namespaces --field-selector spec.nodeName=ip-1-2-3-4.ec2.internal -- /bin/bash -c "echo hello"

ip-1-2-3-4.ec2.internal
$ kubectl exec -it -n namespaceA some-pod-46vp8 -- /bin/bash -c echo hello
hello

$ kubectl exec -it -n namespaceB another-pod-fcvmq -- /bin/bash -c echo hello
hello

$ kubectl exec -it -n namespaceC foo-app-l95cj -- /bin/bash -c echo hello
hello

$ kubectl exec -it -n namespaceD bar-app-6zzb8 -- /bin/bash -c echo hello
hello

Get GPU RAM usage via nvidia-smi on each node in namespaceA

$ multiexec --once-per-node -n namespaceA -- nvidia-smi --query-compute-apps=pid,used_memory --format=csv        

ip-1-2-3-4.ec2.internal
$ kubectl exec -it -n namespaceA foo-app-1 -- nvidia-smi --query-compute-apps=pid,used_memory --format=csv
pid, used_gpu_memory [MiB]
5276, 25 MiB
4860, 2437 MiB

ip-2-3-4-5.ec2.internal
$ kubectl exec -it -n namespaceA bar-app-2 -- nvidia-smi --query-compute-apps=pid,used_memory --format=csv
pid, used_gpu_memory [MiB]
12201, 25 MiB
11509, 2539 MiB
14466, 3713 MiB

ip-3-4-5-6.ec2.internal
$ kubectl exec -it -n namespaceA foo-app-2 -- nvidia-smi --query-compute-apps=pid,used_memory --format=csv
pid, used_gpu_memory [MiB]
20570, 25 MiB
19846, 2157 MiB
14641, 2149 MiB

ip-4-5-6-7.ec2.internal
$ kubectl exec -it -n namespaceA bar-app-1 -- nvidia-smi --query-compute-apps=pid,used_memory --format=csv
pid, used_gpu_memory [MiB]
23317, 25 MiB
7236, 4501 MiB
30002, 1009 MiB

Metadata

Release files for multiexec 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for multiexec 0.0.4
File Size Uploaded Provenance Actions
multiexec-0.0.4.tar.gz 3.6 kB Without provenance Details for multiexec-0.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for multiexec 0.0.4
File Interpreter ABI Platform Actions
multiexec-0.0.4-py3-none-any.whl Python 3 none any Details for multiexec-0.0.4-py3-none-any.whl

Total release size: 7.7 kB

Release files / multiexec-0.0.4.tar.gz

Download URL multiexec-0.0.4.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8e48082a0d50faf4831dc8714f9a0e148ee0f2ff7edc5d153d716422a1ae5681
BLAKE2b-256 checksum
How to use checksums
0ac28397be4ad0a8da0e31254e4f2f1e12c766ab560559da5bc9af19a7ade302
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.6

Release files / multiexec-0.0.4-py3-none-any.whl

Download URL multiexec-0.0.4-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f25828eff9d1655ff979c733c8ac5211511d82acafd9a67734b5ae4293a1a78
BLAKE2b-256 checksum
How to use checksums
12ed1027732f2fdbcf6e6cdb3d6084ee46b67e9e4a374b37aad48003f41cbbd6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.6

Security for multiexec 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page