Skip to content

Reference · security

RBAC

pk-metal splits the power to change a machine in two. The operator may propose a change. Only a person may approve it. Kubernetes RBAC does the split. The admission policies check the names.

The operator service account may create HostOperations and TalosRollouts but not patch them. A person with pk-metal-approver may patch them. The admission policies stand between both and the API.pk-metal-managerservice accountA personbound to pk-metal-approverAPI serverRBACcreate or patch?Admission policieswho, as whom?HostOperationTalosRolloutapproval.approvedBywrite-oncecreatepatch
Create is propose. Patch is approve. No identity holds both by default.
  1. The manager creates a HostOperation or a TalosRollout with spec.proposedBy set to its own name.
  2. The CRD schema freezes what the object changes. So the only field that a patch can still change is the approval.
  3. A person who holds patch sets approvedBy to their own name. Permission to patch is permission to approve.
  4. The admission policies refuse an approval in another name, a second approval, and an approval by the operator. They refuse an approval of your own proposal only if the site sets selfApproval: Forbidden.
pk-metal-manager (ClusterRole and Role)
Generated from the +kubebuilder:rbac markers of the controllers. The ClusterRole holds the kinds. The Role in pk-metal holds Secrets, ConfigMaps, Jobs, the lease and certificate requests.
pk-metal-approver (ClusterRole)
Read and patch operations and rollouts. Read Hosts, clusters and nodes. Nothing binds it by default. A patch can also set annotations on an operation: abort, retry, and the guard overrides metal.platform-kit.org/ignore-window and metal.platform-kit.org/override-cluster-guard. So an approver can also lift these guards. The guard-lift policy makes the value name the approver.
pk-metal-oncall (ClusterRole)
What the runbooks do. Read each pk-metal kind and the events. Delete operations and rollouts, patch claims, Hosts, Assets and clusters. It has no patch on operations or rollouts, so it cannot approve. It holds no Secret. Nothing binds it by default.
pk-metal-backup (ClusterRole)
Read backup policies and snapshots, and ask for a snapshot now. It holds no Secret and cannot decrypt a backup. Nothing binds it by default.
API groupResourcesVerbsScope
metal.platform-kit.orghostoperationsgetlistwatchpatchcluster
metal.platform-kit.orghostsgetlistwatchcluster
os.platform-kit.orgtalosrolloutsgetlistwatchpatchcluster
os.platform-kit.orgtalosclusterstalosnodesgetlistwatchcluster
API groupResourcesVerbsScope
os.platform-kit.orgetcdbackuppoliciesgetlistwatchcluster
os.platform-kit.orgetcdsnapshotsgetlistwatchcreatecluster
os.platform-kit.orgtalosclustersgetlistcluster
API groupResourcesVerbsScope
metal.platform-kit.orghostoperationsgetlistwatchdeletecluster
metal.platform-kit.orghostclaimshostsassetsgetlistwatchpatchcluster
metal.platform-kit.orgmanagementendpointsendpointprofilesmaintenancewindowsbiosprofilesbiosschemasbiossettingsfirmwareprofilesgetlistwatchcluster
os.platform-kit.orgtalosrolloutsgetlistwatchdeletecluster
os.platform-kit.orgtalosclustersgetlistwatchpatchcluster
os.platform-kit.orgtalosnodesbootassetsetcdbackuppoliciesetcdsnapshotsgetlistwatchcluster
coreeventsgetlistwatchcluster
events.k8s.ioeventsgetlistwatchcluster
getcluster
API groupResourcesVerbsScope
corenodesgetcluster
admissionregistration.k8s.iovalidatingadmissionpoliciesvalidatingadmissionpolicybindingsgetlistcluster
authentication.k8s.iotokenreviewscreatecluster
authorization.k8s.iosubjectaccessreviewscreatecluster
events.k8s.ioeventscreatepatchcluster
metal.platform-kit.orgassetsbiosprofilesendpointprofilesfirmwareprofilesmaintenancewindowsgetlistwatchcluster
metal.platform-kit.orgassets/finalizersassets/statusbiossettings/statushostclaims/statushostoperations/statusmaintenancewindows/statusmanagementendpoints/finalizersupdatecluster
metal.platform-kit.orgbiosschemasbiossettingscreatedeletegetlistupdatewatchcluster
metal.platform-kit.orghostclaimsgetlistupdatewatchcluster
metal.platform-kit.orghostoperationscreatedeletegetlistwatchcluster
metal.platform-kit.orghostsmanagementendpointscreategetlistpatchupdatewatchcluster
metal.platform-kit.orghosts/statusmanagementendpoints/statuspatchcluster
os.platform-kit.orgbootassetscreatedeletegetlistupdatewatchcluster
os.platform-kit.orgbootassets/finalizersbootassets/statusetcdbackuppolicies/statusetcdsnapshots/statustalosclusters/finalizerstalosclusters/statustalosnodes/finalizerstalosnodes/statustalosrollouts/finalizerstalosrollouts/statusupdatecluster
os.platform-kit.orgetcdbackuppoliciestalosclustersgetlistwatchcluster
os.platform-kit.orgetcdsnapshotstalosrolloutscreatedeletegetlistwatchcluster
os.platform-kit.orgtalosnodesgetlistpatchupdatewatchcluster
API groupResourcesVerbsScope
coreconfigmapsgetlistwatchnamespace pk-metal
coreeventscreatepatchnamespace pk-metal
corepodsgetnamespace pk-metal
coresecretscreatedeletegetlistupdatewatchnamespace pk-metal
batchjobscreatedeletegetlistwatchnamespace pk-metal
cert-manager.iocertificaterequestscreatedeletegetnamespace pk-metal
coordination.k8s.ioleasescreategetupdatenamespace pk-metal

Each controller page shows the rules that its markers ask for. See Controllers.

Binding Kind Role Subject
pk-metal-manager ClusterRoleBinding ClusterRole pk-metal-manager ServiceAccount pk-metal/pk-metal-manager
pk-metal-manager RoleBinding in pk-metal Role pk-metal-manager ServiceAccount pk-metal/pk-metal-manager

You bind the approver, backup and on-call roles yourself. Bind them to a group, not to single users:

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: pk-metal-approvers
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: pk-metal-approver
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: Group
name: example:platform-approvers
Change Who may do it What checks it
Propose a HostOperation Anyone with create. The manager does it for you. RBAC, and proposedBy must be your name.
Approve a HostOperation A holder of patch. Also the proposer, unless selfApproval is Forbidden. Never the manager. RBAC, and Admission policies.
Create a HostOperation that needs no approval The manager, or a member of the admin group. hostoperation-approval
Approve a TalosRollout A holder of patch. Also the proposer, unless selfApproval is Forbidden. Never the manager. RBAC, and talosrollout-approval
Pause, resume or abort a rollout A holder of patch. RBAC
Name the TalosNode that a claim installs A member of the admin group. hostclaim-provisioning
Set provisioning.approval: Automatic on a claim A member of the admin group. hostclaim-provisioning
Point a claim at another machine (pk-metal replace) A member of the admin group. hostclaim-provisioning
Lift a maintenance window or the cluster guard on an operation A holder of patch on operations. RBAC
Ask for an etcd snapshot now A holder of pk-metal-backup. RBAC
Create a backup policy, or change its recipients or sink A member of the admin group. etcdbackuppolicy-guard
Create or change an EndpointProfile A member of the admin group. endpointprofile-guard
Restore etcd An approved EtcdRecover operation. The same approval gate
Runbook action Command Role
Read objects and events kubectl get, kubectl describe, pk-metal status pk-metal-oncall
Delete a failed operation pk-metal retry pk-metal-oncall
Mark a failed BIOS or firmware plan for retry pk-metal retry pk-metal-approver
Put a claim on hold, or remove the hold pk-metal hold, pk-metal unhold pk-metal-oncall
Ask for a wipe, remove the mark disk-not-wiped pk-metal wipe, kubectl annotate host pk-metal-oncall
Correct the facts of an Asset kubectl apply pk-metal-oncall
Remove os.platform-kit.org/restore-pending kubectl annotate taloscluster pk-metal-oncall
Stop a rollout for good kubectl delete talosrollout pk-metal-oncall
Approve, abort, pause or resume pk-metal approve, pk-metal abort, pk-metal rollout pk-metal-approver
Lift a window or the cluster guard kubectl annotate hostoperation pk-metal-approver
Take a snapshot now pk-metal backup pk-metal-backup
Restore etcd pk-metal restore A holder of create on operations. A holder of pk-metal-approver approves.

A person on call usually holds pk-metal-oncall and pk-metal-approver. With selfApproval: Forbidden, the admission policies stop them from approving their own proposal. With Allowed, they can propose and approve alone. See Set up approval permissions.

The admin group is pk-metal:admins. It comes from the ConfigMap hostoperation-approval in pk-metal.

Kubernetes has no group objects. A ClusterRoleBinding to a group gives permissions to the members of the group. It does not make a person a member. The API server takes your groups from your credential:

Credential Where the group comes from
Client certificate Each O= of the subject is a group. Issue the certificate with O=pk-metal:admins.
OIDC token The groups claim of your identity provider. Put the person in a group with the name pk-metal:admins, or add a prefix and set that name in the ConfigMap.
Impersonation kubectl --as=<you> --as-group=pk-metal:admins. You need the impersonate verb on users and groups. The virtual lab uses this: mise run lab:apply.

Read your groups:

Terminal window
kubectl auth whoami