Configure Role Binding
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: pod-access-bind
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: pod-access
subjects:
- kind: ServiceAccount
name: ${ServiceAccount}
namespace: ${NameSpace}
while [ -z "${NameSpace}" ]
do
read -p "Please Enter Kubernetes Name Space: " NameSpace
export NameSpace
done
while [ -z "${ServiceAccount}" ]
do
read -p "Please Enter Kubernetes Service Account: " ServiceAccount
export ServiceAccount
done
curl -sS https://itmconsult.ir/kubernetes/rolebinding/roleBinding.yml | envsubst > roleBinding-${NameSpace}-${ServiceAccount}.yml && \
kubectl apply -n ${NameSpace} -f roleBinding-${NameSpace}-${ServiceAccount}.yml && \
echo "EveryThing is OK" && \
rm -rf roleBinding-${NameSpace}-${ServiceAccount}.yml roleBinding.yml
Automatic Way
bash <(curl -s https://itmconsult.ir/kubernetes/rolebinding/roleBinding.sh)
Last updated on 10 Nov 2020
Published on 10 Nov 2020