Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • rbac.yaml 파일 생성

    Code Block
    languageyaml
    $ vi rbac.yaml
    
    kind: ServiceAccount
    apiVersion: v1
    metadata:
      name: nfs-client-provisioner
    ---
    kind: ClusterRole
    apiVersion: rbac.authorization.k8s.io/v1
    metadata:
      name: nfs-client-provisioner-runner
    rules:
      - apiGroups: [""]
        resources: ["persistentvolumes"]
        verbs: ["get", "list", "watch", "create", "delete"]
      - apiGroups: [""]
        resources: ["persistentvolumeclaims"]
        verbs: ["get", "list", "watch", "update"]
      - apiGroups: ["storage.k8s.io"]
        resources: ["storageclasses"]
        verbs: ["get", "list", "watch"]
      - apiGroups: [""]
        resources: ["events"]
        verbs: ["create", "update", "patch"]
    ---
    kind: ClusterRoleBinding
    apiVersion: rbac.authorization.k8s.io/v1
    metadata:
      name: run-nfs-client-provisioner
    subjects:
      - kind: ServiceAccount
        name: nfs-client-provisioner
        namespace: default
    roleRef:
      kind: ClusterRole
      name: nfs-client-provisioner-runner
      apiGroup: rbac.authorization.k8s.io
    ---
    kind: Role
    apiVersion: rbac.authorization.k8s.io/v1
    metadata:
      name: leader-locking-nfs-client-provisioner
    rules:
      - apiGroups: [""]
        resources: ["endpoints"]
        verbs: ["get", "list", "watch", "create", "update", "patch"]
    ---
    kind: RoleBinding
    apiVersion: rbac.authorization.k8s.io/v1
    metadata:
      name: leader-locking-nfs-client-provisioner
    subjects:
      - kind: ServiceAccount
        name: nfs-client-provisioner
        # replace with namespace where provisioner is deployed
        namespace: default
    roleRef:
      kind: Role
      name: leader-locking-nfs-client-provisioner
      apiGroup: rbac.authorization.k8s.io
  • yaml 배포
    $ kubectl create -f rbac.yaml

  • clusterRole 및 바인딩이 생성되었는지 확인

    Code Block
    languagebash
    $ kubectl get clusterrole, clusterrolebinding, role, rolebinding | grep nfs
    clusterrole.rbac.authorization.k8s.io/nfs-client-provisioner-runner 20m
    clusterrolebinding.rbac.authorization.k8s.io/run-nfs-client-provisioner 20m
    role.rbac.authorization.k8s.io/leader-locking-nfs-client-provisioner 20m
    rolebinding.rbac.authorization.k8s.io/leader- locking-nfs-client-provisioner 20m

...