Skip to content

Instantly share code, notes, and snippets.

@noqcks
Created November 26, 2018 18:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save noqcks/04d4f4a2846ec1e0ed2fbda58907ca6d to your computer and use it in GitHub Desktop.
Save noqcks/04d4f4a2846ec1e0ed2fbda58907ca6d to your computer and use it in GitHub Desktop.
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: airflow-scheduler
namespace: airflow
---
# Allows Airflow to grab config maps (airflow.cfg)
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: airflow-scheduler-config
namespace: airflow
subjects:
- kind: ServiceAccount
name: airflow-scheduler
namespace: airflow
roleRef:
kind: Role
name: airflow-get-config
apiGroup: rbac.authorization.k8s.io
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: airflow-get-config
namespace: airflow
rules:
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["get", "watch", "list"]
---
# Allows Airflow to read secrets from Kubernetes
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: airflow-scheduler-secret-reader
namespace: airflow
subjects:
- kind: ServiceAccount
name: airflow-scheduler
namespace: airflow
roleRef:
kind: ClusterRole
name: secret-reader
apiGroup: rbac.authorization.k8s.io
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: secret-reader
namespace: airflow
rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "watch", "list"]
---
# Allows Airflow to delete pods when using the Kubernetes PodOperator
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: airflow-scheduler-binding
namespace: airflow
subjects:
- kind: ServiceAccount
name: airflow-scheduler
namespace: airflow
roleRef:
kind: Role
name: pod-create-delete
apiGroup: rbac.authorization.k8s.io
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: pod-create-delete
namespace: airflow
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: [""]
resources: ["pods/log"]
verbs: ["get"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment