diff --git a/kured-ds.yaml b/kured-ds.yaml index d56651f..2bbad72 100644 --- a/kured-ds.yaml +++ b/kured-ds.yaml @@ -1,3 +1,10 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: kured + namespace: kube-system +--- apiVersion: extensions/v1beta1 kind: DaemonSet metadata: @@ -9,6 +16,7 @@ spec: labels: name: kured spec: + serviceAccountName: kured containers: - name: kured image: quay.io/weaveworks/kured diff --git a/kured-rbac.yaml b/kured-rbac.yaml new file mode 100644 index 0000000..6fad9e1 --- /dev/null +++ b/kured-rbac.yaml @@ -0,0 +1,72 @@ +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: kured +rules: +# Allow kured to read spec.unschedulable +# Allow kubectl to drain/uncordon +# +# NB: These permissions are tightly coupled to the bundled version of kubectl; the ones below +# match https://github.com/kubernetes/kubernetes/blob/v1.9.6/pkg/kubectl/cmd/drain.go +# +- apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "patch"] +- apiGroups: [""] + resources: ["pods"] + verbs: ["list"] +- apiGroups: [""] + resources: ["replicationcontrollers"] + verbs: ["get"] +- apiGroups: ["apps"] + resources: ["statefulsets"] + verbs: ["get"] +- apiGroups: ["extensions"] + resources: ["daemonsets", "replicasets"] + verbs: ["get"] +- apiGroups: ["batch"] + resources: ["jobs"] + verbs: ["get"] +- apiGroups: [""] + resources: ["pods/eviction"] + verbs: ["create"] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: kured +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: kured +subjects: +- kind: ServiceAccount + name: kured + namespace: kube-system +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + namespace: kube-system + name: kured +rules: +# Allow kured to lock/unlock itself +- apiGroups: ["extensions"] + resources: ["daemonsets"] + resourceNames: ["kured"] + verbs: ["update"] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + namespace: kube-system + name: kured +subjects: +- kind: ServiceAccount + namespace: kube-system + name: kured +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: kured