latest Kubernetes version throws RBAC error

11/6/2018

I have a scaler service that was working fine, until my recent kubernetes version upgrade. Now I keep getting the following error. (some info redacted)

Error from server (Forbidden): deployments.extensions "redacted" is forbidden: User "system:serviceaccount:namesspace:saname" cannot get resource "deployments/scale" in API group "extensions" in the namespace "namespace"

I have below cluster role:

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  labels:
    app: redacted
    chart: redacted
    heritage: Tiller
    release: redacted
  name: redacted
rules:
- apiGroups:
  - '*'
  resources: ["configmaps", "endpoints", "services", "pods", "secrets", "namespaces", "serviceaccounts", "ingresses", "daemonsets", "statefulsets", "persistentvolumeclaims", "replicationcontrollers", "deployments", "replicasets"]
  verbs: ["get", "list", "watch", "edit", "delete", "update", "scale", "patch", "create"]
- apiGroups:
  - '*'
  resources: ["nodes"]
  verbs: ["list", "get", "watch"]
-- ravi kiran mahankali
kubernetes

1 Answer

11/6/2018

scale is a subresource, not a verb. Include "deployments/scale" in the resources list.

-- Jordan Liggitt
Source: StackOverflow