Skip to content

Instantly share code, notes, and snippets.

View nathanmcgarvey-modopayments's full-sized avatar

Nathan nathanmcgarvey-modopayments

View GitHub Profile
@nathanmcgarvey-modopayments
nathanmcgarvey-modopayments / ephemeralContainer.zshrc
Last active February 29, 2024 14:45
Launch ephemeral alpine container with copied volumeMounts, env, and envFrom
function ephemeralContainer() {
pod_name="$1"
container_name="$2"
namespace="${3:-default}"
if [[ -z "${pod_name}" || -z "${container_name}" ]]; then
echo "requires pod name as first argument and container name as second argument"
return 1
fi
pod_json="$(kubectl -n "${namespace}" get pod "${pod_name}" -o json)"
if [[ -z "${pod_json}" ]]; then