mirror of
https://github.com/wahyd4/home-docker.git
synced 2026-08-08 20:15:03 +10:00
68 lines
1.6 KiB
YAML
68 lines
1.6 KiB
YAML
# Role in the ingress-nginx namespace granting read access to pod logs
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: Role
|
|
metadata:
|
|
name: links-log-reader
|
|
namespace: ingress-nginx
|
|
rules:
|
|
- apiGroups: [""]
|
|
resources: ["pods"]
|
|
verbs: ["list", "get"]
|
|
- apiGroups: [""]
|
|
resources: ["pods/log"]
|
|
verbs: ["get"]
|
|
|
|
---
|
|
# Bind the Role to the links ServiceAccount (cross-namespace)
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: RoleBinding
|
|
metadata:
|
|
name: links-log-reader
|
|
namespace: ingress-nginx
|
|
roleRef:
|
|
apiGroup: rbac.authorization.k8s.io
|
|
kind: Role
|
|
name: links-log-reader
|
|
subjects:
|
|
- kind: ServiceAccount
|
|
name: links
|
|
namespace: apps
|
|
|
|
---
|
|
|
|
# Role in the ingress-nginx namespace:
|
|
# - read pod logs (for nginxmon)
|
|
# - read & patch the nginx ConfigMap (for ip-ban mini app)
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: Role
|
|
metadata:
|
|
name: links-ingress-nginx-reader
|
|
namespace: ingress-nginx
|
|
rules:
|
|
- apiGroups: [""]
|
|
resources: ["pods"]
|
|
verbs: ["list", "get"]
|
|
- apiGroups: [""]
|
|
resources: ["pods/log"]
|
|
verbs: ["get"]
|
|
- apiGroups: [""]
|
|
resources: ["configmaps"]
|
|
resourceNames: ["ingress-nginx-controller"]
|
|
verbs: ["get", "patch"]
|
|
|
|
---
|
|
# Bind the Role to the links ServiceAccount (cross-namespace: apps → ingress-nginx)
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: RoleBinding
|
|
metadata:
|
|
name: links-ingress-nginx-reader
|
|
namespace: ingress-nginx
|
|
roleRef:
|
|
apiGroup: rbac.authorization.k8s.io
|
|
kind: Role
|
|
name: links-ingress-nginx-reader
|
|
subjects:
|
|
- kind: ServiceAccount
|
|
name: links
|
|
namespace: apps
|