Aller au contenu
EN English versionDemander une démo

Connect a Kubernetes cluster running Velero to the backup profile

For an organisation administrator. Procedure connector.mcp.backup-velero, version 1, reviewed 2026-11-25 against the vendor’s own pages. It applies to the connector type mcp/backup-velero.

It ships with the plugin backup-velero 0.1.0: its source. In the console, once the plugin is installed, it opens with How to set this up on the connector of the plugin’s server, and on Library › Plugins.

Addresses are written <api_url>, <public_url> and <org> here: the console shows the same text with your deployment’s own.

  • A cluster where Velero runs, with at least one Schedule, and someone who can create a service account, a role and an admission policy on it.
  • The backup and backup-velero plugins installed in your organisation (Catalogue, Plugins). The server runs in the platform; there is nothing to host. A plugin that brings a server needs a second person’s approval.
  • The API server must be reachable from the platform, and you must allow its host (and the bucket’s, if you configure one) as the connector’s egress. A cluster API on a private address cannot be reached today: it needs ADR 0224 section 6 (private CIDRs or an outpost), which is not available yet. See the plugin’s README, “Reaching the system”. Do not expose the API server to the internet to get around it.
  • Decide the restore prefix, for instance restore-test-. Every namespace the connector may create or delete starts with it. Pick one no real namespace uses.
  • This procedure is written from the Velero, Kubernetes and Amazon S3 documentation above and the plugin’s fake cluster. It has not been run against a live cluster or bucket. Not confirmed in the documentation, so read defensively by the server and to check on first run: the Restore’s status.progress fields, a BackupStorageLocation’s status.phase and status.lastValidationTime, the velero.io/schedule-name and velero.io/backup-name labels, the phases Finalizing and WaitingForPluginOperations, and above all that a Backup created from a Schedule’s template by trigger_backup is handled by Velero like the one its schedule would have made (it replicates velero backup create --from-schedule; only the CLI’s behaviour was relied on).

It reads the velero.io/v1 resources (Schedule, Backup, Restore, BackupStorageLocation) in Velero’s namespace, and it may list the bucket. It writes in three ways only: it creates a Backup from a Schedule’s own template (trigger_backup), it creates a Restore that restores one namespace of a backup into a new namespace (run_restore_test, always after a person’s approval), and it deletes a namespace it created (cleanup_restore_test).

The prefix is enforced by the connector’s server, not by Kubernetes. Kubernetes RBAC cannot grant “create namespaces whose name starts with restore-test-”: a rule can name resources, verbs and exact resourceNames, but it cannot match a name by prefix. So the service account below necessarily holds the right to create and delete namespaces, and the server is what refuses everything else. It checks, before any write, that the target namespace:

  1. starts with the configured prefix;
  2. is not a reserved namespace (default, kube-system, kube-public, kube-node-lease, the Velero namespace);
  3. for a delete, carries the label tranibor.io/test-restore=true that the server put on it when it created it, so a namespace that happens to share the prefix is never deleted.

That is a control in the connector, so a second one in the cluster is worth having: an admission policy (below) that applies the same rule to this service account, whatever the server does.

  1. Create the service account in a namespace of your choice, for instance tranibor-system: kubectl create serviceaccount tranibor-backup-velero -n tranibor-system.
  1. Read access in Velero’s namespace (a Role bound there):

    apiVersion: rbac.authorization.k8s.io/v1
    kind: Role
    metadata: {name: tranibor-backup-velero, namespace: velero}
    rules:
    - apiGroups: ["velero.io"]
    resources: ["schedules", "backups", "restores", "backupstoragelocations", "volumesnapshotlocations", "podvolumebackups"]
    verbs: ["get", "list"]
    # The two writes in this namespace: a Restore (run_restore_test) and a Backup (trigger_backup).
    - apiGroups: ["velero.io"]
    resources: ["restores", "backups"]
    verbs: ["create"]
  2. Namespace access, cluster-wide (a ClusterRole, because namespaces are cluster-scoped). It needs create and delete on namespaces and cannot be narrowed by name prefix; this is why step 5 matters:

    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRole
    metadata: {name: tranibor-backup-velero-namespaces}
    rules:
    - apiGroups: [""]
    resources: ["namespaces"]
    verbs: ["get", "list", "create", "delete"]

    Bind both to the service account (a RoleBinding in velero, a ClusterRoleBinding for the ClusterRole).

  3. Create a token. For a quick test, kubectl create token tranibor-backup-velero -n tranibor-system --duration=24h. For production, a time-bound token expires: use a long-lived token Secret of type kubernetes.io/service-account-token (see the service-accounts page above), keep it in your secret manager, and rotate it. Hand it to the platform administrator through the secret manager, never by mail or chat.

  4. Restrict the account to the prefix with an admission policy. Kubernetes can express it as a ValidatingAdmissionPolicy (Kubernetes 1.30 and later, admissionregistration.k8s.io/v1):

    apiVersion: admissionregistration.k8s.io/v1
    kind: ValidatingAdmissionPolicy
    metadata: {name: backup-velero-namespace-prefix}
    spec:
    failurePolicy: Fail
    matchConstraints:
    resourceRules:
    - apiGroups: [""]
    apiVersions: ["v1"]
    operations: ["CREATE", "DELETE"]
    resources: ["namespaces"]
    validations:
    - expression: >-
    request.userInfo.username != "system:serviceaccount:tranibor-system:tranibor-backup-velero"
    || (request.operation == "DELETE" ? oldObject.metadata.name : object.metadata.name).startsWith("restore-test-")
    message: "the backup-velero server may only create or delete namespaces named restore-test-*"
    ---
    apiVersion: admissionregistration.k8s.io/v1
    kind: ValidatingAdmissionPolicyBinding
    metadata: {name: backup-velero-namespace-prefix}
    spec:
    policyName: backup-velero-namespace-prefix
    validationActions: ["Deny"]

    The same, as a Kyverno policy:

    apiVersion: kyverno.io/v1
    kind: ClusterPolicy
    metadata: {name: backup-velero-namespace-prefix}
    spec:
    validationFailureAction: Enforce
    rules:
    - name: only-prefixed-namespaces
    match:
    any:
    - resources: {kinds: ["Namespace"], operations: ["CREATE", "DELETE"]}
    subjects: [{kind: ServiceAccount, name: tranibor-backup-velero, namespace: tranibor-system}]
    validate:
    message: "the backup-velero server may only create or delete namespaces named restore-test-*"
    deny:
    conditions:
    all:
    - key: "{{ request.object.metadata.name || request.oldObject.metadata.name }}"
    operator: NotEquals
    value: "restore-test-*"

    Both snippets are examples written from the documentation above and not run on a cluster: test them on a scratch cluster, and adapt the account name and the prefix to your own.

  5. Restoring needs Velero’s own rights, not this account’s: Velero (with its own service account) creates the objects in the target namespace.

The bucket listing is an extra check: it shows whether the newest backup’s objects are in the bucket, which the cluster’s resources alone do not prove. Create a read-only identity on the backup bucket (list and get on that bucket only, no write, no delete), and give its access key and secret key to the platform administrator through your secret manager. The server signs a path-style ListObjectsV2 with Signature Version 4. It was checked against the AWS signing test vector, not against a live bucket.

  1. Catalogue, Plugins, install backup and backup-velero (a second person approves the server).
  2. Organisation, Connectors, configure the backup-velero connector with the fields above. The token and the bucket keys are secrets: type them once.
  3. Add the project’s schedules entry from the template’s README, and a group named platform-owner.
  4. Approval. run_restore_test always waits for a person (the profile’s floor, never lowered). trigger_backup is governed by default; an administrator may let it run automatically.
  • Run the template once by hand with schedule set to one schedule. The report should name that schedule, its backups and the storage location.
  • Approve the restore. Look in the cluster for a namespace <prefix><schedule namespace>-<date> labelled tranibor.io/test-restore=true, and check it is deleted at the end of the run.
  • Try, by hand, to create a namespace named outside the prefix with the service account’s token: the admission policy must refuse it.
  • If you want proof the bucket path works, give an object listing a prefix you know holds a backup.
Symptom Likely cause
401 or 403 from the API server the token expired or the Role/ClusterRole is not bound; check kubectl auth can-i --as=system:serviceaccount:tranibor-system:tranibor-backup-velero list backups.velero.io -n velero
Every schedule Red, location Unavailable Velero cannot reach the bucket: read the location’s message in the report
A restore never finishes Velero itself is unhealthy or the cluster lacks capacity: look at the Velero pod’s log
refused: ... outside the allow-list working as intended; the target did not start with the configured prefix
trigger_backup answers but no backup ever completes the Backup was created and Velero did not pick it up: not confirmed against a live cluster, read the Velero pod’s log
Test namespaces left behind a run stopped before cleanup; delete those labelled tranibor.io/test-restore=true
Field What to put in it
kube_api_url https://kubernetes.example.com:6443, the API server, without a trailing slash
kube_ca_cert the cluster’s CA certificate (PEM); leave empty when the API server’s certificate chains to a public CA
kube_token the bearer token of the service account created below, typed once
restore_namespace_prefix the prefix every test namespace must start with, for instance restore-test- (a dash at the end, 5 to 30 characters)
s3_access_key optional: the access key of a read-only identity on the bucket, typed once
s3_bucket optional: the bucket’s name
s3_endpoint optional: the backup bucket’s S3-compatible endpoint, https://s3.example.com, path-style
s3_prefix optional: the prefix Velero writes under, with a trailing slash (default empty)
s3_region optional: the bucket’s region (default us-east-1)
s3_secret_key optional: its secret key, typed once
velero_namespace the namespace Velero runs in (default velero)

Hosts the platform must be allowed to reach:

  • <the Kubernetes API server host>
  • <the S3 endpoint host, when a bucket is configured>