Is it possible to use command like this as an alias or variable, if so how do I concatenate names at the end ?
k auth can-i get pods --as=system:serviceaccount:default:
export cani=“k auth can-i get pods --as=system:serviceaccount:default:”
$cani saname
Not with an alias. But you could use a shell function:
function can-i {
NS=default
SA=default
if [ -n "$2" ] ; then
SA=$2
if [ -n "$1" ]; then
NS=$1
kubectl auth can-i list pod --as system:serviceaccount:$NS:$SA
return $?
fi
fi
echo "help: can-i NS SA 1>&2"
return 1
}