#!/usr/bin/env bash # # Merge kube config file on stdin with the existing kube config file. set -euo pipefail tmp=$(mktemp) new=$(mktemp) cat > "${tmp}" function _exit() { rm -f "${tmp}" "${new}" } trap _exit EXIT export KUBECONFIG="${tmp}:${HOME}/.kube/config" kubectl config view --merge --flatten > "${new}" mv "${new}" ~/.kube/config