Deploying the SPIRE Agent
Use the SpireAgent custom resource to configure the SPIRE Agent DaemonSet on your nodes. This defines how the agent verifies workloads and manages identity attestation across your Red Hat OpenShift Container Platform cluster.
-
You have access to the cluster as a user with the
cluster-adminrole. -
You have installed Zero Trust Workload Identity Manager in the cluster.
-
Create the
SpireAgentCR:-
Create a YAML file that defines the
SpireAgentCR, for example,SpireAgent.yaml:The following is an example of a
SpireAgent.yamlfile.apiVersion: operator.openshift.io/v1alpha1 kind: SpireAgent metadata: name: cluster spec: socketPath: "/run/spire/agent-sockets" logLevel: "info" logFormat: "text" nodeAttestor: k8sPSATEnabled: "true" workloadAttestors: k8sEnabled: "true" workloadAttestorsVerification: type: "auto" hostCertBasePath: "/etc/kubernetes" hostCertFileName: "kubelet-ca.crt" disableContainerSelectors: "false" useNewContainerLocator: "true"where:
metadata.name-
Specifies that the value must be
cluster. spec.socketPath-
Specifies the directory on the host where the SPIRE agent socket is created. This directory is shared with the SPIFFE CSI driver via the
hostPathvolume. Must match theSpiffeCSIDriver.spec.agentSocketPathfor workloads to access the socket. Must be an absolute path with a maximum length of 256 characters. spec.logLevel-
Specifies the logging level for the SPIRE Server. The valid options are
debug,info,warn, anderror. spec.logFormat-
Specifies the logging format for the SPIRE Server. The valid options are
textandjson. spec.nodeAttestor.k8sPSATEnabled-
Specifies whether Kubernetes Projected Service Account Token (PSAT) node attestation is enabled. When enabled, the SPIRE agent uses K8s PSATs to prove its identity to the SPIRE server during node attestation. The valid options are
trueandfalse. spec.workloadAttestors.k8sEnabled-
Specifies whether the Kubernetes workload attestor is enabled. When enabled, the SPIRE agent can verify workload identities using Kubernetes pod information and service account tokens. The valid options are
trueandfalse. spec.workloadAttestors.workloadAttestorsVerification.type-
Specifies the kubelet certificate verification mode. The valid options are
auto,hostCert, andskip. spec.workloadAttestors.workloadAttestorsVerification.hostCertBasePath-
Specifies the directory containing the kubelet CA certificate. Required when type is
hostCert. Optional when type isauto(defaults to /etc/kubernetes if not specified). spec.workloadAttestors.workloadAttestorsVerification.hostCertFileName-
Specifies the file name for the kubelet’s CA certificate. When combined with
hostCertBasePath, forms the full path. Required when type ishostCert. Optional when type isauto. Defaults tokubelet-ca.crtif not specified. spec.workloadAttestors.disableContainerSelectors-
Specifies whether to disable container selectors in the Kubernetes workload attestor. Set to
trueif usingholdApplicationUntilProxyStartsin Istio. The valid options aretrueandfalse. spec.workloadAttestors.useNewContainerLocator-
Specifies enabling the new container locator algorithm that has support for cgroups v2. The valid options are
trueandfalse.
-
Apply the configuration by running the following command:
$ oc apply -f SpireAgent.yaml
-
-
Verify that the daemon set of the SPIRE Agent is ready and available by running the following command:
$ oc get daemonset -l app.kubernetes.io/name=spire-agent -n zero-trust-workload-identity-managerExample outputNAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE spire-agent 3 3 3 3 3 <none> 10m -
Verify that the status of SPIRE Agent pods is
Runningby running the following command:$ oc get po -l app.kubernetes.io/name=spire-agent -n zero-trust-workload-identity-managerExample outputNAME READY STATUS RESTARTS AGE spire-agent-dp4jb 1/1 Running 0 12m spire-agent-nvwjm 1/1 Running 0 12m spire-agent-vtvlk 1/1 Running 0 12m