Skip to content

Instantly share code, notes, and snippets.

@naingyeminn
naingyeminn / create-k8s-user.sh
Last active September 21, 2024 05:40
Generate kubeconfig with user-based client certificate and assign role.
#!/bin/bash
if [ -z "${1}" ]; then
echo "Please provide a username and the namespace or the username only for the cluster role..."
echo "Usage: ${0} USERNAME [NAMESPACE] [ROLE]"
echo "Example: ${0} auditor default view"
exit
fi
USERNAME=${1}
#!/bin/bash
kubedl() {
echo "Downloading ${2} v${1}..."
curl -LO --progress-bar https://dl.k8s.io/v${1}/bin/linux/amd64/${2}
check ${1} ${2}
mkdir -p "v${1}"
mv ${2} "v${1}/"
}