ITMan Documents

This Weblog Just Created For Document Sysadmin Challenges

Configuring Role

Create and Configure Role for Service Account

apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: pod-access
rules:
- apiGroups:
  - ""
  verbs:
  - "*"
  resources:
  - "pods"
  - "pods/log"

while [ -z "${NameSpace}" ] 
do
	read -p "Please Enter Kubernetes Name Space: " NameSpace
	export NameSpace
done


wget -q https://itmconsult.ir/kubernetes/role/role.yml && \
kubectl apply -n ${NameSpace} -f role.yml && \
echo "EveryThing is OK" && \
rm -rf role.yml

Automatic Way

bash <(curl -s https://itmconsult.ir/kubernetes/role/role.sh)

After Create Role We Need to Create Role Binding and Assing it to Service Account.

Last updated on 10 Nov 2020
Published on 10 Nov 2020