11.6. Enabling user permissions to clone data volumes across namespaces


By default, users cannot clone resources between namespaces. To enable cloning, a user with the cluster-admin role must create and bind a cluster role that grants the required permissions.

To enable a user to clone a virtual machine to another namespace, a user with the cluster-admin role must create a new cluster role. Bind this cluster role to a user to enable them to clone virtual machines to the destination namespace.

11.6.1. Creating RBAC resources for cloning data volumes

You can create a new cluster role that enables permissions for all actions for the datavolumes resource.

Prerequisites

  • You have installed the OpenShift CLI (oc).
  • You must have cluster admin privileges.
注記

If you are a non-admin user that is an administrator for both the source and target namespaces, you can create a Role instead of a ClusterRole where appropriate.

Procedure

  1. Create a ClusterRole manifest:

    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRole
    metadata:
      name: <datavolume_cloner>
    rules:
    - apiGroups: ["cdi.kubevirt.io"]
      resources: ["datavolumes/source"]
      verbs: ["*"]
    # ...

    where:

    <datavolume_cloner>
    Specifies a unique name for the cluster role.
  2. Create the cluster role in the cluster:

    $ oc create -f <datavolume_cloner.yaml>

    where:

    <datavolume_cloner.yaml>
    Specifies the file name of the ClusterRole manifest created in the previous step.
  3. Create a RoleBinding manifest that applies to both the source and destination namespaces and references the cluster role created in the previous step.

    apiVersion: rbac.authorization.k8s.io/v1
    kind: RoleBinding
    metadata:
      name: <allow_clone_to_user>
      namespace: <source_namespace>
    subjects:
    - kind: ServiceAccount
      name: default
      namespace: <destination_namespace>
    roleRef:
      kind: ClusterRole
      name: datavolume-cloner
      apiGroup: rbac.authorization.k8s.io
    • metadata.name specifies a unique name for the role binding.
    • metadata.namespace specifies the namespace for the source data volume.
    • subjects.namespace specifies the namespace to which the data volume is cloned.
    • roleRef.name specifies the name of the cluster role created in the previous step.
  4. Create the role binding in the cluster:

    $ oc create -f <datavolume_cloner.yaml>

    where:

    <datavolume_cloner.yaml>
    Specifies the file name of the RoleBinding manifest created in the previous step.
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

Red Hat ドキュメントについて

Legal Notice

Theme

© 2026 Red Hat
トップに戻る