Deploying confidential containers on Microsoft Azure
Protecting containers and data by leveraging trusted execution environments
Abstract
Preface
Confidential containers provide a confidential computing environment to protect containers and data by leveraging trusted execution environments. You install the OpenShift sandboxed containers Operator on an OpenShift Container Platform cluster for your confidential containers workload after configuring an attestation service such as Red Hat build of Trustee in a trusted environment.
Chapter 1. Provide feedback on Red Hat documentation
You can provide feedback or report an error by submitting the Create Issue form in Jira.
Procedure
- Ensure that you are logged in to Jira. If you do not have a Jira account, you must create a This content is not included.Red Hat Jira account.
- Launch the Content from redhat.atlassian.net is not included.Create Issue form.
- Replace the pre-filled Summary text with a short title that describes your specific issue.
- In the Description field, include the documentation URL, chapter or section number, and a detailed description of the issue.
- Click Create.
Chapter 2. Confidential containers workload protection
You can deploy confidential containers workloads on a Red Hat OpenShift Container Platform cluster running on Microsoft Azure with the Intel® Trust Domain Extensions (TDX) and AMD SEV-SNP Trusted Execution Environments (TEEs). Confidential containers provides a confidential computing environment to protect containers and data by leveraging hardware-based Trusted Execution Environments (TEEs).
Additional resources
2.1. Confidential containers compatibility with OpenShift Container Platform
You must ensure that your Red Hat OpenShift Container Platform version supports the features you require.
The required functionality for OpenShift Container Platform is supported by two main components:
- Kata runtime
- The Kata runtime is included with Red Hat Enterprise Linux CoreOS (RHCOS) and receives updates with every OpenShift Container Platform release. When enabling peer pods with the Kata runtime, the OpenShift sandboxed containers Operator requires external network connectivity to pull the necessary image components and helper utilities to create the pod virtual machine (VM) image.
- OpenShift sandboxed containers Operator
- The OpenShift sandboxed containers Operator is a Rolling Stream Operator, which means the latest version is the only supported version. It works with all currently supported versions of OpenShift Container Platform.
The Operator depends on the features that come with the RHCOS host and the environment it runs in.
You must install RHCOS on the worker nodes. Red Hat Enterprise Linux (RHEL) nodes are not supported.
The following compatibility matrix for confidential containers and OpenShift Container Platform releases identifies compatible features and environments.
Table 2.1. Supported architectures
| Architecture | OpenShift Container Platform version (without GPU) | OpenShift Container Platform version (with GPU) |
|---|---|---|
| x86_64 | 4.19.38+ | 4.21.24+ |
| s390x | 4.19.38+ | — |
There are two ways to deploy the Kata containers runtime:
- Bare metal
- Peer pods
You can deploy confidential containers by using peer pods on Microsoft Azure, Microsoft Azure Red Hat OpenShift, and IBM Z. With the release of OpenShift sandboxed containers 1.13.1, the OpenShift sandboxed containers Operator requires OpenShift Container Platform version 4.19.38 or later for deployments without support for a graphics processing unit (GPU).
The following table describes OpenShift Container Platform versions and features with the following support levels:
- GA: General Availability
- TP: Technology Preview
The version numbers in the table represent the minimum supported version. For example, "4.21.24+" means version 4.21.24 or any later version.
For Microsoft Azure Red Hat OpenShift, the minimum OpenShift Container Platform version listed in the table is supported only after the corresponding z-stream release is available on the Azure Red Hat OpenShift managed service.
Table 2.2. Confidential containers: feature availability by OpenShift Container Platform version
| Platform | Trusted execution environment (TEE) | GPU | 4.19.38+ | 4.20.29+ | 4.21.24+ | 4.22.5+ |
|---|---|---|---|---|---|---|
| Bare metal | Intel® TDX or AMD SEV-SNP | No | GA | GA | GA | GA |
| Intel® TDX or AMD SEV-SNP | NVIDIA H100 or DGX B200 | — | — | GA | GA | |
| IBM Z bare metal | IBM SE for Linux | No | GA | GA | GA | GA |
| IBM Z peer pods | IBM SE for Linux | No | GA | GA | GA | GA |
| Microsoft Azure | Intel® TDX or AMD SEV-SNP | No | GA | GA | GA | GA |
| AMD SEV-SNP | NVIDIA H100 | — | — | — | TP | |
| Microsoft Azure Red Hat OpenShift | Intel® TDX or AMD SEV-SNP | No | GA | GA | GA | GA |
| Amazon Web Services | Intel® TDX or AMD SEV-SNP | No | — | — | — | — |
| Google Cloud | Intel® TDX or AMD SEV-SNP | No | — | — | — | — |
Confidential containers includes Red Hat build of Trustee.
GPU support with Kata requires the KubeletPodResourcesGet feature gate to be enabled. This feature gate is available only in OpenShift Container Platform 4.21 and later. Additionally, the CRI-O fix for extending the timeout that is required for peer pods GPU support is available only in OpenShift Container Platform 4.22 and later.
Azure does not currently support GPU nodes with Intel® TDX.
2.2. Peer pod resource requirements
You must ensure that your cluster has sufficient resources.
Peer pod virtual machines (VMs) require resources in two locations:
-
The worker node. The worker node stores metadata, Kata shim resources (
containerd-shim-kata-v2), remote-hypervisor resources (cloud-api-adaptor), and the tunnel setup between the worker nodes and the peer pod VM. - The cloud instance. This is the actual peer pod VM running in the cloud.
The CPU and memory resources used in the Kubernetes worker node are handled by the pod overhead included in the RuntimeClass (kata-remote) definition used for creating peer pods.
The total number of peer pod VMs running in the cloud is defined as Kubernetes Node extended resources. This limit is per node and is set by the PEERPODS_LIMIT_PER_NODE attribute in the peer-pods-cm config map.
The extended resource is named kata.peerpods.io/vm, and enables the Kubernetes scheduler to handle capacity tracking and accounting.
You can edit the limit per node based on the requirements for your environment after you install the OpenShift sandboxed containers Operator.
A mutating webhook adds the extended resource kata.peerpods.io/vm to the pod specification. It also removes any resource-specific entries from the pod specification, if present. This enables the Kubernetes scheduler to account for these extended resources, ensuring the peer pod is only scheduled when resources are available.
The mutating webhook modifies a Kubernetes pod as follows:
-
The mutating webhook checks the pod for the expected
RuntimeClassNamevalue, specified in theTARGET_RUNTIMECLASSenvironment variable. If the value in the pod specification does not match the value in theTARGET_RUNTIMECLASS, the webhook exits without modifying the pod. If the
RuntimeClassNamevalues match, the webhook makes the following changes to the pod spec:-
The webhook removes every resource specification from the
resourcesfield of all containers and init containers in the pod. -
The webhook adds the extended resource (
kata.peerpods.io/vm) to the spec by modifying the resources field of the first container in the pod. The extended resourcekata.peerpods.io/vmis used by the Kubernetes scheduler for accounting purposes.
-
The webhook removes every resource specification from the
The mutating webhook excludes specific system namespaces in OpenShift Container Platform from mutation. If a peer pod is created in those system namespaces, then resource accounting using Kubernetes extended resources does not work unless the pod spec includes the extended resource.
As a best practice, define a cluster-wide policy to only allow peer pod creation in specific namespaces.
2.3. Common terms
The following terms are used throughout the documentation.
- Attestation
- The process of verifying the integrity and trustworthiness of a Trusted Execution Environment (TEE) and the confidential containers workloads running within it, ensuring that only trusted code and data are executed. Red Hat build of Trustee performs this function.
- Confidential containers
- A technology that provides a confidential computing environment to protect containers and data by leveraging Trusted Execution Environments.
- Initdata
- A specification used to securely initialize a pod with workload-specific data (such as certificates, cryptographic keys, or an optional Kata Agent policy) at runtime, preventing the need to embed this data directly in the virtual machine (VM) image.
- Kata Agent
- A component within the pod Virtual Machine (VM) that enforces runtime policies and manages the lifecycle of the containers running inside the VM. Its policy controls application programming interface (API) requests for peer pods.
- Kata containers
- Kata containers is a core upstream project that is used to build OpenShift sandboxed containers. OpenShift sandboxed containers integrates Kata containers with OpenShift Container Platform.
kataruntime- The optional runtime installed by the OpenShift sandboxed containers Operator when configuring bare metal deployments.
kata-ccruntime- The runtime class used specifically for confidential containers deployments on bare-metal servers.
kata-remoteruntime- The runtime class used for peer pod deployments on cloud platforms or remote hypervisors.
KataConfig- A custom resource used to configure and launch OpenShift sandboxed containers.
TrusteeConfig- A custom resource used to configure and launch Red Hat build of Trustee.
- OpenShift sandboxed containers
- OpenShift sandboxed containers integrates Kata containers as an optional runtime to provide enhanced security and isolation for container workloads by running applications in lightweight virtual machines.
- OpenShift sandboxed containers Operator
- The OpenShift sandboxed containers Operator manages the lifecycle of OpenShift sandboxed containers and confidential containers on a cluster.
- Peer pod
A peer pod in OpenShift sandboxed containers extends the concept of a standard pod. Unlike a standard sandboxed container, where the virtual machine is created on the worker node itself, in a peer pod, the virtual machine is created through a remote hypervisor using any supported hypervisor or cloud provider API.
The peer pod acts as a regular pod on the worker node, with its corresponding VM running elsewhere. The remote location of the VM is transparent to the user and is specified by the runtime class in the pod specification. The peer pod design circumvents the need for nested virtualization.
- Pod
A pod is a construct that is inherited from Kubernetes and OpenShift Container Platform. It represents resources where containers can be deployed. Containers run inside pods, and pods are used to specify resources that can be shared between multiple containers.
In the context of OpenShift sandboxed containers, a pod is implemented as a virtual machine. Several containers can run in the same pod on the same virtual machine.
- Red Hat build of Trustee
- Red Hat build of Trustee is an attestation service that verifies the trustworthiness of the location where you plan to run your workload or where you plan to send confidential information. Red Hat build of Trustee includes components deployed on a trusted side and used to verify whether the remote workload is running in a Trusted Execution Environment (TEE).
- Red Hat build of Trustee Operator
- The Red Hat build of Trustee Operator manages the installation, lifecycle, and configuration of Red Hat build of Trustee.
- Runtime class
- An object that describes the specific runtime configuration used to run a workload.
- Sandbox
A sandbox is an isolated environment where programs can run. In a sandbox, you can run untested or untrusted programs without risking harm to the host machine or the operating system.
In the context of OpenShift sandboxed containers, sandboxing is achieved by running workloads in a different kernel using virtualization, providing enhanced control over the interactions between multiple workloads that run on the same host.
- Trusted Execution Environment (TEE)
- Hardware-based security technology leveraged by confidential containers to protect containers and data. Examples: Intel® TDX, AMD SEV-SNP.
2.4. OpenShift sandboxed containers Operator
The OpenShift sandboxed containers Operator encapsulates all of the components from Kata containers. It manages installation, lifecycle, and configuration tasks.
The OpenShift sandboxed containers Operator is packaged in the Operator bundle format as two container images:
- The bundle image contains metadata and is required to make the Operator ready for Operator Lifecycle Manager (OLM).
-
The second container image contains the actual controller that monitors and manages the
KataConfigresource.
The OpenShift sandboxed containers Operator is based on the Red Hat Enterprise Linux CoreOS (RHCOS) extensions concept. RHCOS extensions are a mechanism to install optional OpenShift Container Platform software. The OpenShift sandboxed containers Operator uses this mechanism to deploy sandboxed containers on a cluster.
The sandboxed containers RHCOS extension contains RPMs for Kata, Quick Emulator (QEMU), and its dependencies. You can enable them by using the MachineConfig resources that the Machine Config Operator provides.
Chapter 3. Installation
You install confidential containers on Microsoft Azure with the Intel® Trust Domain Extensions (TDX) and AMD SEV-SNP Trusted Execution Environments (TEEs) by configuring your environment and installing the OpenShift sandboxed containers Operator.
Perform the following steps:
- Configure outbound connectivity for your pod virtual machine (VM) subnet.
- Install the OpenShift sandboxed containers Operator.
3.1. Prerequisites
Review the following prerequisites before deploying confidential containers.
You have installed the latest version of Red Hat OpenShift Container Platform on the cluster where you are running your confidential containers workload.
ImportantCheck the Compatibility with OpenShift Container Platform for the specific minimum version required for confidential containers in release 1.13, as it requires a higher version than OpenShift sandboxed containers.
- You have deployed Red Hat build of Trustee on an OpenShift Container Platform cluster in a trusted environment. For more information, see This content is not included.Deploying Red Hat build of Trustee.
- You have enabled ports 15150 and 9000 for communication in the subnet used for worker nodes and the pod virtual machine (VM). The ports enable communication between the Kata shim running on the worker node and the Kata agent running on the pod VM.
- You have configured a private mirror registry with the required Operator and workload images.
- You have configured non-overlapping network CIDRs between the workload cluster and the Red Hat build of Trustee cluster.
-
You have configured your network to allow outbound access from peer pod VMs to the Azure
AzureCloudservice tag. Peer pod VMs require access to Azure APIs even in a disconnected environment.
3.2. Outbound connections
To enable peer pods to communicate with external networks, such as the public internet, you must configure outbound connectivity for the pod virtual machine (VM) subnet. This involves setting up a network address translation (NAT) gateway and, optionally, defining how the subnet integrates with your cluster’s virtual network (VNet) in Azure.
If you use a private endpoint to access the container registry, a NAT gateway is not required. In disconnected environments, peer pods can reach the registry over the private network without public internet access.
- Peer pods and subnets
- Peer pods operate in a dedicated Azure subnet that requires explicit configuration for outbound access. This subnet can either be the default worker subnet used by OpenShift Container Platform nodes or a separate, custom subnet created specifically for peer pods.
- VNet peering
- When using a separate subnet, VNet peering connects the peer pod VNet to the cluster’s VNet, ensuring internal communication while maintaining isolation. This requires non-overlapping CIDR ranges between the VNets.
You can configure outbound connectivity in two ways:
- Default worker subnet: Modify the existing worker subnet to include a NAT gateway. This is simpler and reuses cluster resources, but it offers less isolation.
- Peer pod VNet: Set up a dedicated VNet and subnet for peer pods, attach a NAT gateway, and peer it with the cluster VNet. This provides greater isolation and flexibility at the cost of additional complexity.
3.2.1. Configure the default worker subnet
You can configure the default worker subnet for outbound connections by attaching a NAT gateway. This method is simple and reuses cluster resources, but it offers less isolation than a dedicated virtual network.
Prerequisites
-
The Azure command-line interface (CLI) (
az) is installed and authenticated. - You have administrator access to the Azure resource group and the VNet.
Procedure
Set the
AZURE_RESOURCE_GROUPenvironment variable by running the following command:$ AZURE_RESOURCE_GROUP=$(oc get infrastructure/cluster \ -o jsonpath='{.status.platformStatus.azure.resourceGroupName}')Set the
AZURE_REGIONenvironment variable by running the following command:$ AZURE_REGION=$(az group show --resource-group ${AZURE_RESOURCE_GROUP}\ --query "{Location:location}" --output tsv) && \ echo "AZURE_REGION: \"$AZURE_REGION\""Set the
AZURE_VNET_NAMEenvironment variable by running the following command:$ AZURE_VNET_NAME=$(az network vnet list \ -g "${AZURE_RESOURCE_GROUP}" --query '[].name' -o tsv)Set the
AZURE_SUBNET_IDenvironment variable by running the following command:$ AZURE_SUBNET_ID=$(az network vnet subnet list \ --resource-group "${AZURE_RESOURCE_GROUP}" \ --vnet-name "${AZURE_VNET_NAME}" --query "[].{Id:id} \ | [? contains(Id, 'worker')]" --output tsv)Set the NAT gateway environment variables for the peer pod subnet by running the following commands:
$ export PEERPOD_NAT_GW=peerpod-nat-gw
$ export PEERPOD_NAT_GW_IP=peerpod-nat-gw-ip
Create a public IP address for the NAT gateway by running the following command:
$ az network public-ip create -g "${AZURE_RESOURCE_GROUP}" \ -n "${PEERPOD_NAT_GW_IP}" -l "${AZURE_REGION}" --sku StandardCreate the NAT gateway and associate it with the public IP address by running the following command:
$ az network nat gateway create -g "${AZURE_RESOURCE_GROUP}" \ -l "${AZURE_REGION}" --public-ip-addresses "${PEERPOD_NAT_GW_IP}" \ -n "${PEERPOD_NAT_GW}"Update the VNet subnet to use the NAT gateway by running the following command:
$ az network vnet subnet update --nat-gateway "${PEERPOD_NAT_GW}" \ --ids "${AZURE_SUBNET_ID}"Confirm the NAT gateway is attached to the VNet subnet by running the following command:
$ az network vnet subnet show --ids "${AZURE_SUBNET_ID}" \ --query "natGateway.id" -o tsvThe output contains the NAT gateway resource ID. If no NAT gateway is attached, the output is empty.
/subscriptions/12345678-1234-1234-1234-1234567890ab/resourceGroups/myResourceGroup/providers/Microsoft.Network/natGateways/myNatGateway
3.2.2. Create a dedicated peer pod virtual network
You can configure outbound connections for peer pods by creating a dedicated virtual network (VNet). Then, you create a network address translation (NAT) gateway for the VNet, create a subnet within the VNet, and enable VNet peering with non-overlapping address spaces.
This method is more complex than creating a NAT gateway for the default worker subnet but it provides greater isolation and flexibility.
Prerequisites
-
The Azure command-line interface (CLI) (
az) is installed and authenticated. See Content from learn.microsoft.com is not included.Authenticate to Azure using Azure CLI. - You have administrator access to the Azure resource group and VNet hosting the cluster.
-
You have verified the cluster VNet classless inter-domain routing (CIDR) address. The default value is
10.0.0.0/14. If you overrode the default value, you have ensured that you chose a non-overlapping CIDR address for the peer pod VNet. For example,192.168.0.0/16.
Procedure
Set the environmental variables for the peer pod network:
Set the peer pod VNet environment variables by running the following commands:
$ export PEERPOD_VNET_NAME="${PEERPOD_VNET_NAME:-peerpod-vnet}"$ export PEERPOD_VNET_CIDR="${PEERPOD_VNET_CIDR:-192.168.0.0/16}"Set the peer pod subnet environment variables by running the following commands:
$ export PEERPOD_SUBNET_NAME="${PEERPOD_SUBNET_NAME:-peerpod-subnet}"$ export PEERPOD_SUBNET_CIDR="${PEERPOD_SUBNET_CIDR:-192.168.0.0/24}"NoteFor example, if
PEERPOD_VNET_CIDRis192.168.0.0/16, specify a subnet CIDR within that range with a longer prefix length, such as192.168.0.0/24.
Set the environmental variables for Azure:
$ AZURE_RESOURCE_GROUP=$(oc get infrastructure/cluster \ -o jsonpath='{.status.platformStatus.azure.resourceGroupName}')$ AZURE_REGION=$(az group show --resource-group ${AZURE_RESOURCE_GROUP}\ --query "{Location:location}" --output tsv) && \ echo "AZURE_REGION: \"$AZURE_REGION\""$ AZURE_VNET_NAME=$(az network vnet list \ -g "${AZURE_RESOURCE_GROUP}" --query '[].name' -o tsv)Set the peer pod NAT gateway environment variables by running the following commands:
$ export PEERPOD_NAT_GW="${PEERPOD_NAT_GW:-peerpod-nat-gw}"$ export PEERPOD_NAT_GW_IP="${PEERPOD_NAT_GW_IP:-peerpod-nat-gw-ip}"Configure the VNET:
Create the peer pod VNet by running the following command:
$ az network vnet create --resource-group "${AZURE_RESOURCE_GROUP}" \ --name "${PEERPOD_VNET_NAME}" \ --address-prefixes "${PEERPOD_VNET_CIDR}"Create a public IP address for the peer pod VNet by running the following command:
$ az network public-ip create -g "${AZURE_RESOURCE_GROUP}" \ -n "${PEERPOD_NAT_GW_IP}" -l "${AZURE_REGION}" \ --sku StandardCreate a NAT gateway for the peer pod VNet by running the following command:
$ az network nat gateway create -g "${AZURE_RESOURCE_GROUP}" \ -l "${AZURE_REGION}" \ --public-ip-addresses "${PEERPOD_NAT_GW_IP}" \ -n "${PEERPOD_NAT_GW}"Create a subnet in the peer pod VNet and attach the NAT gateway by running the following command:
$ az network vnet subnet create \ --resource-group "${AZURE_RESOURCE_GROUP}" \ --vnet-name "${PEERPOD_VNET_NAME}" \ --name "${PEERPOD_SUBNET_NAME}" \ --address-prefixes "${PEERPOD_SUBNET_CIDR}" \ --nat-gateway "${PEERPOD_NAT_GW}"
Configure the virtual network peering connection:
Create the peering connection by running the following command:
$ az network vnet peering create -g "${AZURE_RESOURCE_GROUP}" \ -n peerpod-azure-vnet-to-peerpod-vnet \ --vnet-name "${AZURE_VNET_NAME}" \ --remote-vnet "${PEERPOD_VNET_NAME}" --allow-vnet-access \ --allow-forwarded-trafficSync the peering connection by running the following command:
$ az network vnet peering sync -g "${AZURE_RESOURCE_GROUP}" \ -n peerpod-azure-vnet-to-peerpod-vnet \ --vnet-name "${AZURE_VNET_NAME}"Complete the peering connection by running the following command:
$ az network vnet peering create -g "${AZURE_RESOURCE_GROUP}" \ -n peerpod-peerpod-vnet-to-azure-vnet \ --vnet-name "${PEERPOD_VNET_NAME}" \ --remote-vnet "${AZURE_VNET_NAME}" --allow-vnet-access \ --allow-forwarded-traffic
Verification
Check the peering connection status from the cluster VNet by running the following command:
$ az network vnet peering show -g "${AZURE_RESOURCE_GROUP}" \ -n peerpod-azure-vnet-to-peerpod-vnet \ --vnet-name "${AZURE_VNET_NAME}" \ --query "peeringState" -o tsvThe command returns
Connectedif the peering connection is established.Verify that the NAT gateway is attached to the peer pod subnet by running the following command:
$ az network vnet subnet show --resource-group "${AZURE_RESOURCE_GROUP}" \ --vnet-name "${PEERPOD_VNET_NAME}" --name "${PEERPOD_SUBNET_NAME}" \ --query "natGateway.id" -o tsv
3.3. Workload identity on Azure
On OpenShift Container Platform clusters that operate in workload identity / federated identity mode, OpenShift sandboxed containers uses a user-assigned managed identity to authenticate with Azure by using short-lived, federated tokens instead of static secrets. This approach eliminates the need to store and manage long-lived cloud provider credentials.
Workload identity uses the Azure Workload Identity workflow to establish trust between Kubernetes service accounts and Microsoft Entra Workload ID:
- You create an Azure managed identity with the required permissions to manage peer pod virtual machines.
- You create a federated identity credential that links the OpenShift sandboxed containers Operator service account to the managed identity.
-
When installing the OpenShift sandboxed containers Operator, you provide the managed identity credentials (
CLIENTID,TENANTID,SUBSCRIPTIONID) as environment variables in the Operator subscription. - The OpenShift sandboxed containers Operator uses these credentials to create credential configuration secrets.
- Microsoft Entra ID exchanges short-lived Kubernetes service account tokens for Azure access tokens.
- The OpenShift sandboxed containers component uses these access tokens to authenticate Azure API requests for peer pod operations.
Additional resources
3.3.1. Configure Azure managed identity for workload identity
You must create an Azure managed identity, grant it the required permissions, and create a federated identity credential before installing the OpenShift sandboxed containers Operator with workload identity.
Workload identity configuration is required only for clusters that operate in workload identity / federated identity mode.
After you create the managed identity, the identity might take a few seconds to propagate across the Azure cloud. If a subsequent command fails with the error Cannot find user or service principal in graph database, wait a few seconds and retry.
Prerequisites
-
You have installed and configured the Azure CLI (
az). -
You have installed the OpenShift Container Platform CLI (
oc). -
You have access to the cluster as a user with the
cluster-adminrole. - You have a self-managed OpenShift Container Platform cluster on Azure with Microsoft Entra ID enabled.
Procedure
Set the required environment variables for your Azure configuration:
$ export IDENTITY_NAME=<identity_name>
$ export RESOURCE_GROUP=<resource_group_name>
$ export LOCATION=<cluster_location>
Replace the placeholder values with your configuration:
where:
<identity_name>-
Specifies a name for the managed identity (for example,
osc-identity). <resource_group_name>- Specifies the resource group for your OpenShift Container Platform cluster.
<cluster_location>-
Specifies the Azure region where your cluster is deployed (for example,
eastus).
Create an Azure managed identity by running the following command::
$ az identity create \ --name $IDENTITY_NAME \ --resource-group $RESOURCE_GROUP \ --location $LOCATION
Retrieve the identity credentials and set them as environment variables:
$ export CLIENT_ID=$(az identity show \ --name $IDENTITY_NAME \ --resource-group $RESOURCE_GROUP \ --query clientId -o tsv)
$ export TENANT_ID=$(az identity show \ --name $IDENTITY_NAME \ --resource-group $RESOURCE_GROUP \ --query tenantId -o tsv)
$ export SUBSCRIPTION_ID=$(az account show --query id -o tsv)
To verify the values, run the following commands:
$ echo "CLIENT_ID: $CLIENT_ID"
$ echo "TENANT_ID: $TENANT_ID"
$ echo "SUBSCRIPTION_ID: $SUBSCRIPTION_ID"
Grant the required Azure RBAC permissions to the managed identity:
$ ROLES=("Reader" "Virtual Machine Contributor" "Network Contributor" "Storage Account Contributor" "Compute Gallery Artifacts Publisher")$ for r in "${ROLES[@]}"; do \ az role assignment create \ --assignee "$CLIENT_ID" \ --role "$r" \ --scope "/subscriptions/$SUBSCRIPTION_ID"; \ doneThese roles enable the OpenShift sandboxed containers Operator to create and manage peer pod virtual machines, networks, storage resources, and image resources.
Retrieve your cluster’s service account issuer:
$ export ISSUER=$(oc get authentication.config.openshift.io cluster \ -o jsonpath='{.spec.serviceAccountIssuer}')Create a federated identity credential that links the OpenShift sandboxed containers Operator service account to the Azure managed identity:
$ az identity federated-credential create \ --name $IDENTITY_NAME-federation \ --identity-name $IDENTITY_NAME \ --issuer $ISSUER \ --subject system:serviceaccount:openshift-sandboxed-containers-operator:default \ --resource-group $RESOURCE_GROUP \ --audiences openshift
Verification
Verify that the federated identity credential was created:
$ az identity federated-credential list \ --identity-name $IDENTITY_NAME \ --resource-group $RESOURCE_GROUP
[ { "audiences": [ "openshift" ], "id": "/subscriptions/<subscription_id>/resourcegroups/<resource_group>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<identity_name>/federatedIdentityCredentials/<identity_name>-federation", "issuer": "https://<issuer_url>", "name": "<identity_name>-federation", "resourceGroup": "<resource_group>", "subject": "system:serviceaccount:openshift-sandboxed-containers-operator:default", "type": "Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials" } ]Verify that the role assignments were created:
$ az role assignment list --assignee "$CLIENT_ID" --output table
The output should list the five roles assigned to the managed identity.
Next steps
-
Save the
CLIENT_ID,TENANT_ID, andSUBSCRIPTION_IDvalues. You will need these values when installing the OpenShift sandboxed containers Operator.
3.4. Install the OpenShift sandboxed containers Operator
You can install the OpenShift sandboxed containers Operator by using the command-line interface (CLI).
Prerequisites
-
You have access to the cluster as a user with the
cluster-adminrole.
Procedure
Create an
osc-namespace.yamlmanifest file:apiVersion: v1 kind: Namespace metadata: name: openshift-sandboxed-containers-operator
Create the namespace by running the following command:
$ oc create -f osc-namespace.yaml
Create an
osc-operatorgroup.yamlmanifest file:apiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: sandboxed-containers-operator-group namespace: openshift-sandboxed-containers-operator spec: targetNamespaces: - openshift-sandboxed-containers-operator
Create the Operator group by running the following command:
$ oc create -f osc-operatorgroup.yaml
Create an
osc-subscription.yamlmanifest file:apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: sandboxed-containers-operator namespace: openshift-sandboxed-containers-operator spec: channel: stable installPlanApproval: Automatic name: sandboxed-containers-operator source: redhat-operators sourceNamespace: openshift-marketplace startingCSV: sandboxed-containers-operator.v1.13.1
Create the subscription by running the following command:
$ oc create -f osc-subscription.yaml
Verification
Verify that the Operator is correctly installed by running the following command:
$ oc get csv -n openshift-sandboxed-containers-operator
This command can take several minutes to complete.
Watch the installation progress by running the following command:
$ watch oc get csv -n openshift-sandboxed-containers-operator
NAME DISPLAY VERSION PHASE sandboxed-containers-operator.v1.13.1 OpenShift sandboxed containers Operator 1.13.1 Succeeded
The installation is complete when the
PHASEcolumn showsSucceeded.
3.5. Disconnected installation
A disconnected OpenShift Container Platform cluster operates without direct internet access. Running confidential containers in a disconnected environment requires a private mirror registry and Operator image mirroring. Cross-cluster network connectivity through VNet peering is also required.
confidential containers on Azure in a disconnected environment is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.
A disconnected environment requires the following preparations:
- Mirror registry
- Configure a private container registry in Azure to host Operator and workload images. The registry must be accessible from both clusters through private endpoints.
- Operator mirroring
- Mirror the required Operator catalogs and images to the private registry so that Operator Lifecycle Manager (OLM) can install Operators without internet access.
- Workload image mirroring
- Mirror workload container images to the private registry so that peer pod virtual machines (VMs) can pull images directly.
- Network connectivity
- Configure VNet peering between the workload cluster and the Red Hat build of Trustee cluster to enable cross-cluster communication for attestation.
Perform the following steps:
- Configure the mirror registry.
- Add registry credentials to both clusters.
- Copy the pull secret to workload namespaces.
- Mirror Operator images to the private registry.
- Mirror workload images to the private registry.
- Plan non-overlapping network CIDRs for both clusters.
- Create VNet peering for cross-cluster connectivity.
3.5.1. Configure the mirror registry
You create a private Azure Container Registry (ACR) with a private endpoint to host mirrored Operator and workload images. The registry must be accessible from both the workload cluster and the Red Hat build of Trustee cluster through private networking.
Peer pod virtual machines (VMs) pull container images directly from the registry, not through the OpenShift Container Platform cluster. The private registry must be reachable from the VNet where peer pods run.
Prerequisites
-
You have access to the Azure subscription as a user with the
Contributorrole. -
You have installed the Azure command-line interface (CLI) tool (
az).
Procedure
Set environment variables for the registry configuration:
$ REGISTRY_NAME=<registry_name> $ RESOURCE_GROUP=<resource_group> $ LOCATION=<azure_region> $ VNET_NAME=<vnet_name> $ SUBNET_NAME=<subnet_name>
<registry_name>- Specify a unique name for the ACR instance. The name must be alphanumeric.
<resource_group>- Specify the Azure resource group.
<azure_region>-
Specify the Azure region, for example
eastus. <vnet_name>- Specify the VNet name for the private endpoint.
<subnet_name>- Specify the subnet name for the private endpoint.
Create an ACR instance with the Premium SKU and public network access disabled:
$ az acr create \ --resource-group ${RESOURCE_GROUP} \ --name ${REGISTRY_NAME} \ --sku Premium \ --public-network-enabled falseRetrieve the registry resource ID:
$ REGISTRY_ID=$(az acr show \ --name ${REGISTRY_NAME} \ --query 'id' --output tsv)Create a private endpoint for the registry:
$ az network private-endpoint create \ --name "${REGISTRY_NAME}-pe" \ --resource-group ${RESOURCE_GROUP} \ --vnet-name ${VNET_NAME} \ --subnet ${SUBNET_NAME} \ --private-connection-resource-id ${REGISTRY_ID} \ --group-id registry \ --connection-name "${REGISTRY_NAME}-connection"Create a private DNS zone for the registry:
$ az network private-dns zone create \ --resource-group ${RESOURCE_GROUP} \ --name "privatelink.azurecr.io"Link the private DNS zone to the VNet:
$ az network private-dns link vnet create \ --resource-group ${RESOURCE_GROUP} \ --zone-name "privatelink.azurecr.io" \ --name "${VNET_NAME}-link" \ --virtual-network ${VNET_NAME} \ --registration-enabled falseRetrieve the network interface ID of the private endpoint:
$ NETWORK_INTERFACE_ID=$(az network private-endpoint show \ --name "${REGISTRY_NAME}-pe" \ --resource-group ${RESOURCE_GROUP} \ --query 'networkInterfaces[0].id' --output tsv)Retrieve the private IP address of the registry:
$ PRIVATE_IP=$(az network nic show \ --ids ${NETWORK_INTERFACE_ID} \ --query 'ipConfigurations[0].privateIpAddress' --output tsv)Retrieve the private IP address of the data endpoint:
$ DATA_ENDPOINT_PRIVATE_IP=$(az network nic show \ --ids ${NETWORK_INTERFACE_ID} \ --query 'ipConfigurations[1].privateIpAddress' --output tsv)Create a DNS A record for the registry:
$ az network private-dns record-set a add-record \ --record-set-name ${REGISTRY_NAME} \ --zone-name "privatelink.azurecr.io" \ --resource-group ${RESOURCE_GROUP} \ --ipv4-address ${PRIVATE_IP}Create a DNS A record for the data endpoint:
$ az network private-dns record-set a add-record \ --record-set-name "${REGISTRY_NAME}.${LOCATION}.data" \ --zone-name "privatelink.azurecr.io" \ --resource-group ${RESOURCE_GROUP} \ --ipv4-address ${DATA_ENDPOINT_PRIVATE_IP}NoteIf the Red Hat build of Trustee cluster is in a different VNet than the workload cluster, you must also create a private endpoint, DNS zone link, and DNS A records for the Red Hat build of Trustee cluster VNet. Update the
VNET_NAMEandSUBNET_NAMEvariables with the Red Hat build of Trustee cluster VNet values, and then repeat the private endpoint and DNS configuration steps.
Verification
Verify the private endpoint connection by running the following command:
$ az network private-endpoint show \ --name "${REGISTRY_NAME}-pe" \ --resource-group ${RESOURCE_GROUP} \ --query 'privateLinkServiceConnections[0].privateLinkServiceConnectionState.status' \ --output tsvThe output should display
Approved.Verify DNS resolution by running the following command from a host connected to the VNet:
$ nslookup ${REGISTRY_NAME}.azurecr.ioThe output should resolve to the private IP address of the registry.
3.5.2. Add registry credentials to the cluster
You add the mirror registry credentials to the cluster pull secret so that the cluster can authenticate to the private Azure Container Registry (ACR).
In a disconnected environment with separate workload and Red Hat build of Trustee clusters, you must add the registry credentials to both clusters.
Prerequisites
- You have configured the private ACR instance.
-
You have access to the cluster as a user with the
cluster-adminrole.
Procedure
Log in to the ACR instance and retrieve the credentials:
$ ACR_USERNAME=$(az acr credential show \ --name ${REGISTRY_NAME} --query 'username' --output tsv) $ ACR_PASSWORD=$(az acr credential show \ --name ${REGISTRY_NAME} --query 'passwords[0].value' --output tsv)Create a Base64-encoded authentication string:
$ AUTH=$(echo -n "${ACR_USERNAME}:${ACR_PASSWORD}" | base64 -w0)Create a JSON file with the registry credentials:
$ cat <<EOF > acr-credentials.json { "${REGISTRY_NAME}.azurecr.io": { "auth": "${AUTH}" } } EOFAdd the credentials to the cluster pull secret:
$ oc get secret/pull-secret -n openshift-config \ -o jsonpath='{.data.\.dockerconfigjson}' | base64 -d | \ jq --argjson acr "$(cat acr-credentials.json)" '.auths += $acr' \ > merged-pull-secret.json $ oc set data secret/pull-secret -n openshift-config \ --from-file=.dockerconfigjson=merged-pull-secret.jsonSwitch to the Red Hat build of Trustee cluster context, and then repeat steps 1 through 4:
$ oc config use-context <trustee_cluster_context>
Verification
Verify that the pull secret contains the mirror registry credentials by running the following command:
$ oc get secret/pull-secret -n openshift-config \ -o jsonpath='{.data.\.dockerconfigjson}' | base64 -d | \ jq '.auths | keys[]' | grep azurecrThe output displays the registry hostname, for example
<registry_name>.azurecr.io.
3.5.3. Copy the pull secret to workload namespaces
You copy the cluster pull secret to the namespace where your confidential containers workloads run. Peer pod virtual machines (VMs) require the pull secret in the workload namespace to authenticate to the private mirror registry when pulling container images.
Prerequisites
- You have created the namespace for your workload.
Procedure
Export the pull secret from the
openshift-confignamespace:$ oc get secret pull-secret -n openshift-config \ -o jsonpath='{.data.\.dockerconfigjson}' | base64 -d > pull-secret.jsonCreate the pull secret in the workload namespace:
$ oc create secret docker-registry pull-secret \ --from-file=.dockerconfigjson=pull-secret.json \ -n <workload_namespace>
<workload_namespace>- Specify the namespace where your confidential containers workload runs.
Link the pull secret to the default service account in the workload namespace:
$ oc secrets link default pull-secret --for=pull \ -n <workload_namespace>
- Repeat steps 2 and 3 for each workload namespace.
Verification
Verify that the pull secret is linked to the default service account:
$ oc get sa default -n <workload_namespace> -o yaml | grep pull-secret
The output should list
pull-secretin theimagePullSecretssection.
3.5.4. Mirror Operator images
You mirror the required Operator catalog images to the private mirror registry so that Operator Lifecycle Manager (OLM) can install the OpenShift sandboxed containers Operator , the Red Hat build of Trustee Operator, and the Node Feature Discovery (NFD) Operator in a disconnected environment.
Prerequisites
- You have added the registry credentials to both clusters.
-
You have installed the
oc-mirrorOpenShift CLI plugin v2. For details, see This content is not included.About the oc-mirror plugin v2 in the OpenShift Container Platform documentation. - You have disabled the default catalog sources on both clusters. For details, see This content is not included.Disabling the default OperatorHub catalog sources in the OpenShift Container Platform documentation.
Procedure
Create an
ImageSetConfigurationresource to define the Operators to mirror. Save the following YAML asimageset-config.yaml:kind: ImageSetConfiguration apiVersion: mirror.openshift.io/v2alpha1 mirror: operators: - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.22 packages: - name: sandboxed-containers-operator channels: - name: stable - name: trustee-operator channels: - name: stable - name: nfd channels: - name: stableMirror the images to the private registry by running the following command:
$ oc-mirror --v2 --config imageset-config.yaml \ docker://${REGISTRY_NAME}.azurecr.ioThis command mirrors the Operator catalog and all referenced images. The process can take several minutes depending on network speed.
Apply the generated cluster resources to the workload cluster:
$ oc apply -f oc-mirror-workspace/results-*/
This command creates the
CatalogSourceandImageContentSourcePolicyorImageDigestMirrorSetresources required for OLM to use the mirrored catalog.Switch to the Red Hat build of Trustee cluster context:
$ oc config use-context <trustee_cluster_context>
<trustee_cluster_context>-
Specify the context name of the Red Hat build of Trustee cluster. Run
oc config get-contextsto list available contexts.
Apply the same resources to the Red Hat build of Trustee cluster:
$ oc apply -f oc-mirror-workspace/results-*/
Verification
Verify that the catalog source is available on each cluster by running the following command:
$ oc get catalogsource -n openshift-marketplace
The output should list the mirrored catalog source.
Verify that the Operators are available in the mirrored catalog by running the following command:
$ oc get packagemanifest -n openshift-marketplace | grep -E 'sandboxed|trustee'
3.5.5. Mirror workload images
You mirror your workload container images to the private mirror registry. Peer pod virtual machines (VMs) pull container images directly from the registry, so the workload images must be available in the private registry before you deploy confidential containers workloads.
Prerequisites
-
You have installed the
skopeotool. For details, see This content is not included.Installing container tools. - You have network access to the source registry from your workstation.
- You have authentication credentials for both the source registry and the mirror registry.
Procedure
Log in to the private mirror registry:
$ az acr login --name ${REGISTRY_NAME}Copy each workload image from the source registry to the mirror registry by running the following command:
$ skopeo copy \ docker://<source_registry>/<image>:<tag> \ docker://${REGISTRY_NAME}.azurecr.io/<image>:<tag><source_registry>-
Specify the source registry hostname, for example
registry.access.redhat.com. <image>:<tag>Specify the image name and tag, for example
ubi9/ubi:latest.Repeat this step for each workload image that your confidential containers pods require.
If your workload uses images from multiple source registries, create an
ImageDigestMirrorSetresource to redirect image pulls to the mirror registry:apiVersion: config.openshift.io/v1 kind: ImageDigestMirrorSet metadata: name: workload-mirror spec: imageDigestMirrors: - mirrors: - <registry_name>.azurecr.io/<image_path> source: <source_registry>/<image_path><registry_name>- Specify the ACR registry name.
<source_registry>- Specify the original source registry.
<image_path>-
Specify the image path, for example
ubi9/ubi.
Verification
Verify that the images are available in the mirror registry by running the following command:
$ az acr repository list --name ${REGISTRY_NAME} --output tableThe output should list the mirrored workload images.
3.5.6. Network CIDR planning for cross-cluster connectivity
When deploying confidential containers and Red Hat build of Trustee on separate OpenShift Container Platform clusters in a disconnected environment, the clusters must communicate through VNet peering. VNet peering requires non-overlapping network CIDRs across both clusters.
Plan the network CIDRs before creating the clusters. You configure these values in the install-config.yaml file during OpenShift Container Platform installation.
The following table shows an example of non-overlapping CIDR allocations for the workload cluster and the Red Hat build of Trustee cluster:
Table 3.1. Example network CIDR allocations
| Network | Workload cluster | Red Hat build of Trustee cluster |
|---|---|---|
| Machine network |
|
|
| Cluster network (pod CIDR) |
|
|
| Service network |
|
|
The machine network CIDRs must not overlap between the two clusters. The VNet address spaces that contain these subnets are peered, and overlapping address ranges cause peering to fail.
Configure these CIDR ranges in the networking section of the install-config.yaml file for each cluster before installation. For details, see This content is not included.Sample install-config.yaml file for Azure in the OpenShift Container Platform documentation.
3.5.7. Create VNet peering for cross-cluster connectivity
You create bidirectional VNet peering between the workload cluster and the Red Hat build of Trustee cluster to enable cross-cluster communication for attestation. VNet peering connects two Azure virtual networks so that resources in each network can communicate using private IP addresses.
Prerequisites
- You have deployed both OpenShift Container Platform clusters with non-overlapping network CIDRs.
-
You have access to the Azure subscription as a user with the
Network Contributorrole or equivalent permissions on both VNets.
Procedure
Retrieve the resource group name of the workload cluster:
$ WORKLOAD_RG=$(oc get infrastructure/cluster \ -o jsonpath='{.status.platformStatus.azure.resourceGroupName}')Retrieve the VNet name and resource ID of the workload cluster:
$ WORKLOAD_VNET_NAME=$(az network vnet list \ --resource-group ${WORKLOAD_RG} \ --query "[].name" --output tsv) $ WORKLOAD_VNET_ID=$(az network vnet show \ --resource-group ${WORKLOAD_RG} \ --name ${WORKLOAD_VNET_NAME} \ --query id --output tsv)Retrieve the resource group name of the Red Hat build of Trustee cluster:
$ TRUSTEE_RG=<trustee_resource_group>
<trustee_resource_group>-
Specify the resource group of the Red Hat build of Trustee cluster. If you have
ocaccess to the Red Hat build of Trustee cluster, you can retrieve this value by runningoc get infrastructure/cluster -o jsonpath='{.status.platformStatus.azure.resourceGroupName}'.
Retrieve the VNet name and resource ID of the Red Hat build of Trustee cluster:
$ TRUSTEE_VNET_NAME=$(az network vnet list \ --resource-group ${TRUSTEE_RG} \ --query "[].name" --output tsv) $ TRUSTEE_VNET_ID=$(az network vnet show \ --resource-group ${TRUSTEE_RG} \ --name ${TRUSTEE_VNET_NAME} \ --query id --output tsv)Create VNet peering from the workload cluster to the Red Hat build of Trustee cluster:
$ az network vnet peering create \ --name workload-to-trustee \ --resource-group ${WORKLOAD_RG} \ --vnet-name ${WORKLOAD_VNET_NAME} \ --remote-vnet ${TRUSTEE_VNET_ID} \ --allow-vnet-accessCreate VNet peering from the Red Hat build of Trustee cluster to the workload cluster:
$ az network vnet peering create \ --name trustee-to-workload \ --resource-group ${TRUSTEE_RG} \ --vnet-name ${TRUSTEE_VNET_NAME} \ --remote-vnet ${WORKLOAD_VNET_ID} \ --allow-vnet-access
Verification
Verify that the peering state is
Connectedon the workload cluster side:$ az network vnet peering show \ --name workload-to-trustee \ --resource-group ${WORKLOAD_RG} \ --vnet-name ${WORKLOAD_VNET_NAME} \ --query peeringState --output tsvConnected
Verify that the peering state is
Connectedon the Red Hat build of Trustee cluster side:$ az network vnet peering show \ --name trustee-to-workload \ --resource-group ${TRUSTEE_RG} \ --vnet-name ${TRUSTEE_VNET_NAME} \ --query peeringState --output tsvConnected
3.5.8. Install the OpenShift sandboxed containers Operator
You can install the OpenShift sandboxed containers Operator by using the command-line interface (CLI).
Prerequisites
-
You have access to the cluster as a user with the
cluster-adminrole. - You have disabled the default catalog sources and mirrored the Operator catalog. For details, see This content is not included.Using Operator Lifecycle Manager in disconnected environments in the OpenShift Container Platform documentation.
Procedure
Create an
osc-namespace.yamlmanifest file:apiVersion: v1 kind: Namespace metadata: name: openshift-sandboxed-containers-operator
Create the namespace by running the following command:
$ oc create -f osc-namespace.yaml
Create an
osc-operatorgroup.yamlmanifest file:apiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: sandboxed-containers-operator-group namespace: openshift-sandboxed-containers-operator spec: targetNamespaces: - openshift-sandboxed-containers-operator
Create the Operator group by running the following command:
$ oc create -f osc-operatorgroup.yaml
Create an
osc-subscription.yamlmanifest file:apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: sandboxed-containers-operator namespace: openshift-sandboxed-containers-operator spec: channel: stable installPlanApproval: Automatic name: sandboxed-containers-operator source: <mirror_catalog_source> sourceNamespace: openshift-marketplace startingCSV: sandboxed-containers-operator.v1.13.1
<mirror_catalog_source>-
Specify the name of the
CatalogSourceresource created by theoc-mirrortool. You can find this name by runningoc get catalogsource -n openshift-marketplace.
Create the subscription by running the following command:
$ oc create -f osc-subscription.yaml
Verification
Verify that the Operator is correctly installed by running the following command:
$ oc get csv -n openshift-sandboxed-containers-operator
This command can take several minutes to complete.
Watch the installation progress by running the following command:
$ watch oc get csv -n openshift-sandboxed-containers-operator
NAME DISPLAY VERSION PHASE sandboxed-containers-operator.v1.13.1 OpenShift sandboxed containers Operator 1.13.1 Succeeded
The installation is complete when the
PHASEcolumn showsSucceeded.
Chapter 4. Configuration
You can configure confidential containers on Microsoft Azure with the Intel® Trust Domain Extensions (TDX) and AMD SEV-SNP Trusted Execution Environments (TEEs).
Perform the following steps:
- Enable ports to allow internal communication with peer pods.
- Enable confidential containers.
Create initdata to initialize a pod with sensitive or workload-specific data at runtime.
ImportantDo not use the default permissive Kata Agent policy in a production environment. You must configure a restrictive policy, preferably by creating initdata.
As a minimum requirement, you must disable
ExecProcessRequestto prevent a cluster administrator from accessing sensitive data by running theoc execcommand on a confidential containers pod.- Create the peer pods config map.
- Optional: Add initdata to a pod manifest to override the global initdata configuration set in the peer pods config map.
- Optional: If you select a custom peer pod virtual machine (VM) image from an authenticated registry, configure a pull secret.
- Optional: Select a custom peer pod VM image.
-
Create the
KataConfigcustom resource (CR). - Verify the attestation process.
- Configure your workload for confidential containers.
4.1. Enable ports for peer pod communication
You must enable ports 15150 and 9000 to allow internal communication with peer pods running on Azure.
Prerequisites
- You have installed the Azure command line interface (CLI) tool.
-
You have access to the cluster as a user with the
cluster-adminrole.
Procedure
Set the Azure resource group variable:
$ export AZURE_RESOURCE_GROUP="<resource_group_name>"where:
<resource_group_name>- Specifies the name of the resource group that contains your OpenShift Container Platform cluster.
Retrieve the network security group (NSG) name:
$ NSG_NAME=$(az network nsg list -g "${AZURE_RESOURCE_GROUP}" \ --query "[].name" -o tsv)NoteThis command assumes that only one NSG exists in the resource group. If you have multiple NSGs, manually identify which NSG your worker subnet uses and set
NSG_NAMEexplicitly.Enable port 15150 for communication between the Kata shim and agent:
$ az network nsg rule create -g "${AZURE_RESOURCE_GROUP}" \ --nsg-name "${NSG_NAME}" -n "AllowKataShimAgent" \ --priority 200 --direction Inbound --access Allow \ --protocol Tcp --destination-port-ranges 15150 \ --source-address-prefixes "VirtualNetwork" \ --destination-address-prefixes "VirtualNetwork"Enable port 9000 for Virtual Extensible LAN (VXLAN) tunnel traffic:
$ az network nsg rule create -g "${AZURE_RESOURCE_GROUP}" \ --nsg-name "${NSG_NAME}" -n "AllowVXLAN" \ --priority 201 --direction Inbound --access Allow \ --protocol Tcp --destination-port-ranges 9000 \ --source-address-prefixes "VirtualNetwork" \ --destination-address-prefixes "VirtualNetwork"
Verification
Verify that the NSG rules exist:
$ az network nsg rule list -g "${AZURE_RESOURCE_GROUP}" \ --nsg-name "${NSG_NAME}" -o table
4.2. Enable confidential containers
You enable confidential containers by creating an osc-feature-gates config map.
Prerequisites
-
You have access to the cluster as a user with the
cluster-adminrole.
Procedure
Create a
my-feature-gate.yamlmanifest file:apiVersion: v1 kind: ConfigMap metadata: name: osc-feature-gates namespace: openshift-sandboxed-containers-operator data: confidential: "true"
Create the config map by running the following command:
$ oc create -f my-feature-gate.yaml
Verification
Verify that the config map exists by running the following command:
$ oc get configmap osc-feature-gates -n openshift-sandboxed-containers-operator
NAME DATA AGE osc-feature-gates 1 10s
Confirm that
confidential: "true"is present in the config map data by running the following command:$ oc get configmap osc-feature-gates -n openshift-sandboxed-containers-operator -o jsonpath='{.data}'{"confidential":"true"}
4.3. Initializing pods at runtime by using initdata
You can initialize a pod with workload-specific data at runtime by creating and applying initdata.
This approach enhances security by reducing the exposure of confidential information and improves flexibility by eliminating custom image builds. For example, initdata can include three configuration settings:
- An X.509 certificate for secure communication.
- A cryptographic key for authentication.
-
An optional Kata Agent
policy.regofile to enforce runtime behavior when overriding the default Kata Agent policy.
The initdata content configures the following components:
- Attestation Agent (AA), which verifies the trustworthiness of the pod by sending evidence for attestation.
- Confidential Data Hub (CDH), which manages secrets and secure data access within the pod virtual machine (VM).
- Kata Agent, which enforces runtime policies and manages the lifecycle of the containers inside the pod VM.
You create an initdata.toml file and convert it to a gzip-format Base64-encoded string.
Then, you create a hash from the initdata file. This hash is required as a reference value for the Reference Value Provider Service (RVPS) config map for Red Hat build of Trustee.
4.4. Create initdata
You create initdata to securely initialize a pod with sensitive or workload-specific data at runtime, avoiding the need to embed this data in a virtual machine image. This approach provides additional security by reducing the risk of exposure of confidential information and eliminates the need for custom image builds.
You can specify initdata in the peer pods config map, for global configuration, or in a peer pod manifest, for a specific pod. The initdata value in a peer pod manifest overrides the value set in the peer pods config map.
Then, you generate a Platform Configuration Register (PCR) 8 hash from the initdata.toml file for the Reference Value Provider Service (RVPS) config map for Red Hat build of Trustee.
Red Hat build of Trustee uses the RVPS to validate attestation evidence sent by confidential workloads. The RVPS contains trusted reference values, such as file hashes, that are compared to the PCR measurements included in attestation requests. These hashes are not generated by Red Hat build of Trustee.
Prerequisites
-
You have deleted the
kbs_certsetting if you configureinsecure_http = truein thekbs-configconfig map for Red Hat build of Trustee.
Procedure
Obtain the Red Hat build of Trustee uniform resource locator (URL) by running the following command:
$ TRUSTEE_URL=$(oc get route kbs-service \ -n trustee-operator-system -o jsonpath='{.spec.host}') \ && echo $TRUSTEE_URLCreate the
initdata.tomlfile:algorithm = sha256 version = "0.1.0" [data] "aa.toml" = ''' [token_configs] [token_configs.coco_as] url = '<trustee_url>' [token_configs.kbs] url = '<trustee_url>' ''' "cdh.toml" = ''' socket = 'unix:///run/confidential-containers/cdh.sock' credentials = [] [kbc] name = 'cc_kbc' url = '<trustee_url>' kbs_cert = """ -----BEGIN CERTIFICATE----- <kbs_certificate> -----END CERTIFICATE----- """ [image] image_security_policy_uri = 'kbs:///default/<secret_policy_name>/<key>' ''' "policy.rego" = ''' package agent_policy import future.keywords.in import future.keywords.if default AddARPNeighborsRequest := true default AddSwapRequest := true default CloseStdinRequest := true default CreateSandboxRequest := true default DestroySandboxRequest := true default GetMetricsRequest := true default GetOOMEventRequest := true default GuestDetailsRequest := true default ListInterfacesRequest := true default ListRoutesRequest := true default MemHotplugByProbeRequest := true default OnlineCPUMemRequest := true default PauseContainerRequest := true default PullImageRequest := true default RemoveContainerRequest := true default RemoveStaleVirtiofsShareMountsRequest := true default ReseedRandomDevRequest := true default ResumeContainerRequest := true default SetGuestDateTimeRequest := true default SignalProcessRequest := true default StartContainerRequest := true default StartTracingRequest := true default StatsContainerRequest := true default StopTracingRequest := true default TtyWinResizeRequest := true default UpdateContainerRequest := true default UpdateEphemeralMountsRequest := true default UpdateInterfaceRequest := true default UpdateRoutesRequest := true default WaitProcessRequest := true default WriteStreamRequest := true default CreateContainerRequest := true default ReadStreamRequest := false default CopyFileRequest := false default SetPolicyRequest := false default ExecProcessRequest := false CopyFileRequest if { print("CopyFileRequest: input =", input) allow_copy_file print("CopyFileRequest: true") } allow_copy_file if { print("allow_copy_file regular") input.file_type == "Regular" allow_copy_file_path(input.path, "") print("allow_copy_file regular: true") } allow_copy_file if { print("allow_copy_file directory") input.file_type == "Directory" allow_copy_file_path(input.path, "") print("allow_copy_file directory: true") } allow_copy_file if { print("allow_copy_file symlink") input.file_type == "Symlink" allow_copy_file_path(input.path, ".*/.+") check_directory_traversal(input.symlink_target) not startswith(input.symlink_target, "/") print("allow_copy_file symlink: true") } allow_copy_file_path(path, regex_suffix) if { check_directory_traversal(path) some regex1 in policy_data.request_defaults.CopyFileRequest regex2 := replace(regex1, "$(sfprefix)", policy_data.common.sfprefix) regex3 := replace(regex2, "$(cpath)", policy_data.common.cpath) regex4 := replace(regex3, "$(bundle-id)", "[a-z0-9]{64}") regex5 := concat("", [regex4, regex_suffix]) print("allow_copy_file_path: regex5 =", regex5) regex.match(regex5, path) } check_directory_traversal(i_path) if { not regex.match("(^|/)\\.\\.($|/)", i_path) } policy_data := { "common": { "cpath": "/run/kata-containers/shared/containers(?:/passthrough)?", "sfprefix": "^$(cpath)/(watchable/)?$(bundle-id)-[a-z0-9]{16}-" }, "request_defaults": { "CopyFileRequest": [ "$(sfprefix)" ] } } '''- URL
-
Specify Red Hat build of Trustee URL. If you configure Red Hat build of Trustee with
insecure_httpfor testing purposes, use HTTP. Otherwise, use HTTPS. For production systems, avoid usinginsecure_httpunless you configure your environment to handle Transport Layer Security (TLS) externally, for example, with a proxy. - kbs_certificate
- Specify the Base64-encoded TLS certificate for the attestation agent.
- kbs_cert
-
See the prerequisite above regarding
kbs_certandinsecure_http. - image_security_policy_uri
-
Optional, only if you enabled the container image signature verification policy. Replace
<secret_policy_name>with the name of the secret that contains the policy and<key>with the key within that secret.
Convert the
initdata.tomlfile to a gzipped, Base64-encoded string in a text file by running the following command:$ cat initdata.toml | gzip | base64 -w0 > initdata.txt
Record this string to use in the peer pods config map or the peer pod manifest.
Calculate the hash of the
initdata.tomlfile and assign its value to thehashvariable by running the command that corresponds to thealgorithmvalue you set in theinitdata.tomlfile:For
sha256:+
$ hash=$(sha256sum initdata.toml | cut -d' ' -f1)
For
sha384:+
$ hash=$(sha384sum initdata.toml | cut -d' ' -f1)
For
sha512:+
$ hash=$(sha512sum initdata.toml | cut -d' ' -f1)
Assign 32 bytes of 0s to the
initial_pcrvariable by running the following command:$ initial_pcr=0000000000000000000000000000000000000000000000000000000000000000
Calculate the SHA-256 hash of
hashandinitial_pcrand assign its value to thePCR8_HASHvariable by running the following command:$ PCR8_HASH=$(echo -n "$initial_pcr$hash" | xxd -r -p | sha256sum | cut -d' ' -f1) && echo $PCR8_HASH
Record the
PCR8_HASHvalue for the RVPS config map.
Verification
Verify that the
initdata.txtfile exists and is not empty by running the following command:$ ls -lh initdata.txt && cat initdata.txt
Confirm that the file exists and has a Base64-encoded string.
Verify that the
PCR8_HASHvariable was set by running the following command:$ echo $PCR8_HASH
Confirm that the output is a non-empty hash value.
Additional resources
4.5. Retrieve cloud provider values
You retrieve network and infrastructure values from your Microsoft Azure instance. You use these values when you create the peer pods config map.
Procedure
Retrieve and record the Azure resource group by running the following command:
$ AZURE_RESOURCE_GROUP=$(oc get infrastructure/cluster \ -o jsonpath='{.status.platformStatus.azure.resourceGroupName}') \ && echo "AZURE_RESOURCE_GROUP: \"$AZURE_RESOURCE_GROUP\""Retrieve and record the Azure VNet name:
$ AZURE_VNET_NAME=$(az network vnet list \ --resource-group ${AZURE_RESOURCE_GROUP} \ --query "[].{Name:name}" --output tsv)Use this value to retrieve the Azure subnet ID.
Retrieve and record the Azure subnet ID:
$ AZURE_SUBNET_ID=$(az network vnet subnet list \ --resource-group ${AZURE_RESOURCE_GROUP} --vnet-name $AZURE_VNET_NAME \ --query "[].{Id:id} | [? contains(Id, 'worker')]" --output tsv) \ && echo "AZURE_SUBNET_ID: \"$AZURE_SUBNET_ID\""Retrieve and record the Azure network security group (NSG) ID:
$ AZURE_NSG_ID=$(az network nsg list --resource-group ${AZURE_RESOURCE_GROUP} \ --query "[].{Id:id}" --output tsv) && echo "AZURE_NSG_ID: \"$AZURE_NSG_ID\""Retrieve and record the Azure region:
$ AZURE_REGION=$(az group show --resource-group ${AZURE_RESOURCE_GROUP} \ --query "{Location:location}" --output tsv) \ && echo "AZURE_REGION: \"$AZURE_REGION\""
4.6. Create the peer pods config map
You create the peer pods config map to provide cloud provider credentials and configuration settings that the OpenShift sandboxed containers Operator uses to create and manage peer pod virtual machine instances.
Optional: Add initdata to the peer pods config map to create a default configuration for all peer pods.
Procedure
Create a
peer-pods-cm.yamlmanifest file according to the following example:apiVersion: v1 kind: ConfigMap metadata: name: peer-pods-cm namespace: openshift-sandboxed-containers-operator data: CLOUD_PROVIDER: "azure" VXLAN_PORT: "9000" PROXY_TIMEOUT: "8m" AZURE_INSTANCE_SIZE: "Standard_DC2as_v5" AZURE_INSTANCE_SIZES: "Standard_DC2as_v5,Standard_DC4as_v5,Standard_DC8as_v5" AZURE_SUBNET_ID: "<azure_subnet_id>" AZURE_NSG_ID: "<azure_nsg_id>" AZURE_IMAGE_ID: "" AZURE_REGION: "<azure_region>" AZURE_RESOURCE_GROUP: "<azure_resource_group>" TAGS: "key1=value1,key2=value2" PEERPODS_LIMIT_PER_NODE: "10" ROOT_VOLUME_SIZE: "10" DISABLECVM: "false" INITDATA: "<initdata_string>"
AZURE_INSTANCE_SIZE-
Defines the default instance size that is used if the instance size is not defined in the workload object.
"Standard_DC2as_v5"is for AMD SEV-SNP. If your trusted execution environment (TEE) is Intel® Trust Domain Extensions (TDX), specifyStandard_EC4eds_v5. AZURE_IMAGE_ID- Leave this value empty. When you install the Operator, a Job is scheduled to download the default pod virtual machine (VM) image from the Red Hat Ecosystem Catalog and upload it to the Azure Image Gallery within the same Azure Resource Group as the OpenShift Container Platform cluster. This image provides root disk integrity protection (dm-verity) and encrypted container storage. See This content is not included.Confidential VMs: The core of confidential containers for details.
AZURE_INSTANCE_SIZES- Specify the allowed instance sizes, without spaces, for creating the pod. You can define smaller instance sizes for workloads that need less memory and fewer CPUs or larger instance sizes for larger workloads.
TAGS-
You can configure custom tags as
key=valuepairs for pod VM instances to track peer pod costs or to identify peer pods in different clusters. PEERPODS_LIMIT_PER_NODE-
Maximum number of peer pods per node. The default value is
10. ROOT_VOLUME_SIZE- Root volume size in gigabytes for the pod VM. The minimum size is 10 GB.
INITDATA- Specify the initdata string to create a default configuration for all peer pods. If you add initdata to a peer pod manifest, that setting overrides this global configuration.
Create the config map by running the following command:
$ oc create -f peer-pods-cm.yaml
Verification
Verify that the peer pods config map exists by running the following command:
$ oc get configmap peer-pods-cm -n openshift-sandboxed-containers-operator
NAME DATA AGE peer-pods-cm 10 10s
Additional resources
4.7. Apply initdata to a pod
You can override the global INITDATA setting you applied in the peer pods config map by applying customized initdata to a specific pod for special use cases, such as development and testing with a relaxed policy, or when using different Red Hat build of Trustee configurations. You can customize initdata by adding an annotation to the workload pod YAML.
Prerequisites
-
The
kata-remoteruntime class is available on your cluster.
Procedure
Add the initdata string to the pod manifest and save the file as
my-pod.yaml:apiVersion: v1 kind: Pod metadata: name: ocp-cc-pod labels: app: ocp-cc-pod annotations: io.katacontainers.config.hypervisor.cc_init_data: <initdata_string> spec: runtimeClassName: kata-remote containers: - name: <container_name> image: registry.access.redhat.com/ubi9/ubi:latest command: - sleep - "36000" securityContext: privileged: false seccompProfile: type: RuntimeDefaultwhere
<initdata_string>-
Specify the gzipped, Base64-encoded initdata value in a pod annotation to override the global
INITDATAsetting in the peer pods config map. <container_name>- Specify a container name.
Create the pod by running the following command:
$ oc create -f my-pod.yaml
Verification
Verify that the pod is running by running the following command:
$ oc get pod ocp-cc-pod
NAME READY STATUS RESTARTS AGE ocp-cc-pod 1/1 Running 0 30s
Verify that the pod is using the expected runtime class by running the following command:
$ oc get pod <pod_name> -o jsonpath='{.spec.runtimeClassName}'Confirm the output matches the expected runtime class, for example,
kata-remote.
4.8. Use a custom VM image for peer pods
You can select a custom peer pod virtual machine (VM) image by adding an annotation to the pod manifest. The custom image overrides the default image specified in the peer pods config map. If the image is in a private registry, you must first configure a pull secret.
Prerequisites
- You have the ID of a custom pod VM image, which is compatible with your cloud provider or hypervisor.
Procedure
Optional: If the custom pod VM image is in a private registry, configure a pull secret:
Set the
NSvariable to the namespace where you deploy your peer pods:$ NS=<namespace>
Copy the pull secret to the peer pod namespace:
$ oc get secret pull-secret -n openshift-config -o yaml \ | sed "s/namespace: openshift-config/namespace: ${NS}/" \ | oc apply -n "${NS}" -f -You can use the cluster pull secret, as in this example, or a custom pull secret.
Optional: Link the pull secret to the default service account:
$ oc secrets link default pull-secret --for=pull -n ${NS}
Create a
my-pod-manifest.yamlfile according to the following example:apiVersion: v1 kind: Pod metadata: name: my-pod-manifest annotations: io.katacontainers.config.hypervisor.image: "<custom_image_id>" spec: runtimeClassName: kata-remote containers: - name: <example_container> image: registry.access.redhat.com/ubi9/ubi:9.3 command: ["sleep", "36000"]Create the pod by running the following command:
$ oc create -f my-pod-manifest.yaml
Verification
Verify that the pod is running with the custom peer pod VM image by running the following command:
$ oc get pod my-pod-manifest -o jsonpath='{.metadata.annotations.io\.katacontainers\.config\.hypervisor\.image}'- Confirm that the output matches the custom image ID you specified.
Additional resources
4.9. Create the KataConfig custom resource
You must create the KataConfig custom resource (CR) to install kata-remote as a runtime class on your worker nodes.
Prerequisites
-
Be aware that creating the
KataConfigCR automatically reboots the worker nodes. The reboot can take from 10 to more than 60 minutes depending on your deployment size, hardware type, and other factors.
Procedure
Create an
example-kataconfig.yamlmanifest file according to the following example:apiVersion: kataconfiguration.openshift.io/v1 kind: KataConfig metadata: name: example-kataconfig spec: enablePeerPods: true logLevel: info # kataConfigPoolSelector: # matchLabels: # <label_key>: '<label_value>'
<label_key>: '<label_value>'-
Optional: If you have applied node labels to install
kata-remoteon specific nodes, specify the key and value, for example,kata-remote: 'true'.
Create the
KataConfigCR by running the following command:$ oc create -f example-kataconfig.yaml
The new
KataConfigCR is created and installskata-remoteas a runtime class on the worker nodes.Wait for the
kata-remoteinstallation to complete and the worker nodes to reboot before verifying the installation.Optional: Monitor the installation progress by running the following command:
$ watch "oc describe kataconfig | sed -n /^Status:/,/^Events/p"
When the status of all workers under
kataNodesisinstalledand the conditionInProgressisFalsewithout specifying a reason, thekata-remoteis installed on the cluster.
Verification
Verify the daemon set by running the following command:
$ oc get -n openshift-sandboxed-containers-operator ds/osc-caa-ds
Verify the runtime classes by running the following command:
$ oc get runtimeclass
NAME HANDLER AGE kata kata 34m kata-nvidia-gpu kata-nvidia-gpu 34m kata-remote kata-remote 152m
You can also see the default
kataruntime class in addition tokata-remote.
4.10. Verify attestation
You can verify the attestation process by creating a test pod to retrieve a specific resource from Red Hat build of Trustee.
This procedure is an example to verify that attestation is working. Do not write sensitive data to standard I/O, because the data can be captured by using a memory dump. Only data written to memory is encrypted.
Prerequisites
- You have deployed the confidential containers workload.
- You have configured initdata with the Red Hat build of Trustee URL.
- You have configured the Red Hat build of Trustee.
Procedure
Create a
test-pod.yamlmanifest file:apiVersion: v1 kind: Pod metadata: name: ocp-cc-pod labels: app: ocp-cc-pod annotations: io.katacontainers.config.hypervisor.cc_init_data: "<initdata_string>" spec: runtimeClassName: kata-remote containers: - name: skr-openshift image: registry.access.redhat.com/ubi9/ubi:latest command: - sleep - "36000" securityContext: privileged: false seccompProfile: type: RuntimeDefaultwhere:
io.katacontainers.config.hypervisor.cc_init_data-
Optional: Specifies initdata in a pod annotation, which overrides the global
INITDATAsetting in the peer pods config map.
Create the pod by running the following command:
$ oc create -f test-pod.yaml
Log in to the pod by running the following command:
$ oc exec -it ocp-cc-pod -- bash
Verification
Fetch the Red Hat build of Trustee resource to confirm that attestation succeeded:
$ curl http://127.0.0.1:8006/cdh/resource/default/attestation-status/status
success #/
Additional resources
4.11. Configure your workload
You configure your workload for confidential containers by setting kata-remote as the runtime class for the following pod-templated objects:
-
Podobjects -
ReplicaSetobjects -
ReplicationControllerobjects -
StatefulSetobjects -
Deploymentobjects -
DeploymentConfigobjects
Do not deploy workloads in an Operator namespace. Create a dedicated namespace for these resources.
You can define whether the workload should be deployed using the default instance size, which you defined in the peer pods config map, by adding an annotation to the YAML file.
If you do not want to define the instance size manually, you can add an annotation to use an automatic instance size, based on the memory available.
Procedure
Add
spec.runtimeClassName: kata-remoteto the manifest of each pod-templated workload object as in the following example:apiVersion: v1 kind: <object> # ... spec: runtimeClassName: kata-remote # ...
Optional: To override the default instance size, add the following annotation with an instance size that is defined in the peer pods config map:
apiVersion: v1 kind: <object> metadata: annotations: io.katacontainers.config.hypervisor.machine_type: <instance> # ...Optional: To use an automatic instance size, add the following annotations:
apiVersion: v1 kind: <Pod> metadata: annotations: io.katacontainers.config.hypervisor.default_vcpus: <vcpus> io.katacontainers.config.hypervisor.default_memory: <memory> # ...The workload runs on an automatic instance size based on the amount of memory available.
Apply the changes to the workload object by running the following command:
$ oc apply -f <object.yaml>
OpenShift Container Platform creates the workload object and begins scheduling it.
Verification
-
Inspect the
spec.runtimeClassNamefield of a pod-templated object. If the value iskata-remote, then the workload is running on confidential containers.
4.12. Configuring confidential containers for NVIDIA GPUs
You can run confidential containers workloads with NVIDIA GPU acceleration by using Confidential H100 virtual machine (VM) instances on Azure. Instead of configuring the GPU Operator and drivers on the host, peer pods provision a Standard_NCC40ads_H100_v5 instance type VM that includes the NVIDIA H100 GPU device inside a confidential VM.
4.12.1. Prerequisites for NVIDIA GPU workloads
Before you configure confidential containers for NVIDIA GPU workloads on Azure, ensure that the following requirements are met.
- OpenShift Container Platform version 4.22 or later.
-
The
Standard_NCC40ads_H100_v5instance type is available in the region where the cluster is deployed, for example,eastus2orwesteurope. -
You have sufficient quota in your Azure subscription to provision
Standard_NCC40ads_H100_v5instances. - You have installed the OpenShift sandboxed containers Operator.
- You have created the peer pods config map.
4.12.2. Extend the kubelet runtime request timeout
GPU-accelerated peer pods require a longer runtime request timeout because provisioning GPU instances takes more time than standard instances. You must extend the kubelet runtimeRequestTimeout on the worker nodes where Kata containers run.
Prerequisites
- You have cluster administrator access.
Procedure
Create a
KubeletConfigcustom resource (CR) to extend the runtime request timeout:apiVersion: machineconfiguration.openshift.io/v1 kind: KubeletConfig metadata: name: kata-remote-kubelet-timeout-extension spec: machineConfigPoolSelector: matchLabels: pools.operator.machineconfiguration.openshift.io/kata-oc: "" kubeletConfig: runtimeRequestTimeout: 8mApply the
KubeletConfigCR by running the following command:$ oc apply -f gpu-kubelet-config.yaml
Wait for the machine config pools to update by running the following command:
$ oc get mcp --watch
Wait until all machine config pools show
UPDATED=TrueandUPDATING=Falsebefore proceeding.
4.12.3. Add the GPU instance type to the peer pods config map
You must add the Standard_NCC40ads_H100_v5 GPU instance type to the peer pods config map instance sizes list so that it is available for GPU workloads.
Procedure
Edit the peer pods config map by running the following command:
$ oc edit cm peer-pods-cm -n openshift-sandboxed-containers-operator
Add
Standard_NCC40ads_H100_v5to theAZURE_INSTANCE_SIZESvalue. For example:data: AZURE_INSTANCE_SIZES: "Standard_B2als_v2,Standard_D2as_v5,Standard_D4as_v5,Standard_D2ads_v5,Standard_NC40ads_H100_v5"
Verification
Verify that the config map includes the GPU instance type by running the following command:
$ oc get cm peer-pods-cm -n openshift-sandboxed-containers-operator \ -o jsonpath='{.data.AZURE_INSTANCE_SIZES}'The output must include
Standard_NCC40ads_H100_v5.
4.12.4. Deploy a GPU workload
To run a workload on a GPU instance, you must add annotations to the pod specification that specify the H100 instance type and request the GPU device.
Prerequisites
- You have a workload container base image based on RHEL 9, RHEL 10, or an equivalent UBI image.
Procedure
Create a pod manifest that includes an annotation specifying the GPU VM instance type and resource requests for the GPU device. For example:
apiVersion: v1 kind: Pod metadata: name: gpu-workload annotations: io.katacontainers.config.hypervisor.machine_type: "Standard_NCC40ads_H100_v5" spec: runtimeClassName: kata-remote containers: - name: cuda-sample image: "nvcr.io/nvidia/k8s/cuda-sample:vectoradd-cuda12.5.0" imagePullPolicy: Always command: ["/bin/sleep"] args: ["infinity"] resources: requests: nvidia.com/gpu: 1 limits: nvidia.com/gpu: 1 securityContext: privileged: false allowPrivilegeEscalation: false runAsNonRoot: true runAsUser: 1001 capabilities: drop: - ALL seccompProfile: type: RuntimeDefaultio.katacontainers.config.hypervisor.machine_type-
Specifies the Azure instance type for the peer pod VM. Set this value to
"Standard_NCC40ads_H100_v5"for the Confidential H100 GPU instance. resources.requestsandresources.limits-
Specify the number of GPU devices to assign to the pod. GPU overcommit is not allowed, so the
requestsandlimitsvalues must match.
Create the pod by running the following command:
$ oc apply -f gpu-workload.yaml
Wait for the pod to reach
Runningstatus by running the following command:$ oc get pod gpu-workload --watch
NoteGPU instances take longer to provision than standard instances. Allow several minutes for the pod to start.
4.12.5. Verify GPU functionality
After you deploy a GPU workload, verify that the NVIDIA GPU is accessible from within the container.
Procedure
Verify that the GPU is accessible by running
nvidia-smi:$ oc exec pod/gpu-workload -- nvidia-smi
The output displays the NVIDIA H100 GPU details, including driver version, GPU memory, and temperature.
Optional: Run the CUDA
VectorAddsample program to verify that CUDA is functional:$ oc exec pod/gpu-workload -- /cuda-samples/vectorAdd
ImportantDue to longer provisioning and cleanup times for GPU instances, verify that all pod VM instances have been removed from your Azure cluster after usage. Orphaned virtual machines can cause unnecessary resource consumption and unexpected costs.
Chapter 5. Upgrade
You update confidential containers by updating the OpenShift Container Platform cluster and the OpenShift sandboxed containers Operator.
Then, you update the pod virtual machine (VM) image by deleting and re-creating KataConfig custom resource (CR). Updating the OpenShift sandboxed containers Operator when enablePeerPods: true is set in the KataConfig CR does not update the pod VM image automatically.
You must perform the following steps:
Update your OpenShift Container Platform cluster to update the
Kataruntime and its dependencies.The RHCOS extension
sandboxed containerscontains the required components to run OpenShift sandboxed containers, such as the Kata containers runtime, the hypervisor Quick Emulator (QEMU), and other dependencies. You update the extension by updating the cluster to a new release of OpenShift Container Platform.- Update the OpenShift sandboxed containers Operator.
-
Delete the
KataConfigCR. - Verify that the image ID in the peer pods config map is empty.
-
Re-create the
KataConfigCR.
Additional resources
5.1. Upgrade the OpenShift sandboxed containers Operator
You can upgrade the OpenShift sandboxed containers Operator by using the command-line interface (CLI).
Prerequisites
-
You have access to the cluster as a user with the
cluster-adminrole.
Procedure
Create an
osc-subscription.yamlmanifest file:apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: sandboxed-containers-operator namespace: openshift-sandboxed-containers-operator spec: channel: stable installPlanApproval: Automatic name: sandboxed-containers-operator source: redhat-operators sourceNamespace: openshift-marketplace startingCSV: sandboxed-containers-operator.v1.13.1
Create the subscription by running the following command:
$ oc create -f osc-subscription.yaml
Verification
Verify that the Operator upgrade is complete by running the following command:
$ oc get csv -n openshift-sandboxed-containers-operator
This command can take several minutes to complete.
Watch the upgrade progress by running the following command:
$ watch oc get csv -n openshift-sandboxed-containers-operator
NAME DISPLAY VERSION REPLACES PHASE openshift-sandboxed-containers openshift-sandboxed-containers-operator 1.13.1 1.13.0 Succeeded
The upgrade is complete when the
PHASEcolumn showsSucceededfor the new version.
Additional resources
5.2. Delete the KataConfig custom resource
You must delete the KataConfig custom resource (CR).
Deleting the KataConfig CR automatically reboots the worker nodes. Reboot can take from 10 to 60 minutes. The following factors can affect the reboot time:
- A larger OpenShift Container Platform deployment with a greater number of worker nodes.
- Activation of the BIOS and Diagnostics utility.
- Deployment on a hard drive rather than an SSD.
- Deployment on physical nodes such as bare metal, rather than on virtual nodes.
- A slow central processing unit (CPU) and network.
Prerequisites
-
You have deleted all pods that use the
kata-remoteruntime class.
Procedure
Delete the
KataConfigCR by running the following command:$ oc delete kataconfig example-kataconfig
The OpenShift sandboxed containers Operator removes all resources that were initially created to enable the runtime on your cluster.
ImportantWhen you delete the
KataConfigCR, the command-line interface (CLI) stops responding until all worker nodes reboot. You must wait for the deletion process to complete before performing the verification.
Verification
Confirm that the
KataConfigCR no longer exists by running the following command:$ oc get kataconfig example-kataconfig
Error from server (NotFound): kataconfigs.kataconfiguration.openshift.io "example-kataconfig" not found
Additional resources
5.3. Verify the peer pod image ID is empty
When you configure a custom pod virtual machine (VM) image for peer pods, you must verify that the image ID in the peer pods config map is empty before the Operator populates it with the image URI.
Prerequisites
-
You have access to the cluster as a user with the
cluster-adminrole.
Procedure
Obtain the value of the AZURE_IMAGE_ID in the peer pods config map by running the following command:
$ oc get configmap -n openshift-sandboxed-containers-operator peer-pods-cm -o jsonpath="{.data.AZURE_IMAGE_ID}"If the value is not empty, update the value and patch the config map by running the following command:
$ oc patch configmap peer-pods-cm -n openshift-sandboxed-containers-operator -p '{"data":{"AZURE_IMAGE_ID":""}}'
Verification
Verify that the image ID value is empty by running the following command:
$ oc get configmap -n openshift-sandboxed-containers-operator peer-pods-cm \ -o jsonpath="{.data.AZURE_IMAGE_ID}"If the image ID value is empty, the command returns no output.
Additional resources
5.4. Create the KataConfig custom resource
You must create the KataConfig custom resource (CR) to install kata-remote as a runtime class on your worker nodes.
Prerequisites
-
Be aware that creating the
KataConfigCR automatically reboots the worker nodes. The reboot can take from 10 to more than 60 minutes depending on your deployment size, hardware type, and other factors.
Procedure
Create an
example-kataconfig.yamlmanifest file according to the following example:apiVersion: kataconfiguration.openshift.io/v1 kind: KataConfig metadata: name: example-kataconfig spec: enablePeerPods: true logLevel: info # kataConfigPoolSelector: # matchLabels: # <label_key>: '<label_value>'
<label_key>: '<label_value>'-
Optional: If you have applied node labels to install
kata-remoteon specific nodes, specify the key and value, for example,kata-remote: 'true'.
Create the
KataConfigCR by running the following command:$ oc create -f example-kataconfig.yaml
The new
KataConfigCR is created and installskata-remoteas a runtime class on the worker nodes.Wait for the
kata-remoteinstallation to complete and the worker nodes to reboot before verifying the installation.Optional: Monitor the installation progress by running the following command:
$ watch "oc describe kataconfig | sed -n /^Status:/,/^Events/p"
When the status of all workers under
kataNodesisinstalledand the conditionInProgressisFalsewithout specifying a reason, thekata-remoteis installed on the cluster.
Verification
Verify the daemon set by running the following command:
$ oc get -n openshift-sandboxed-containers-operator ds/osc-caa-ds
Verify the runtime classes by running the following command:
$ oc get runtimeclass
NAME HANDLER AGE kata kata 34m kata-nvidia-gpu kata-nvidia-gpu 34m kata-remote kata-remote 152m
You can also see the default
kataruntime class in addition tokata-remote.
Chapter 6. Uninstallation
You uninstall confidential containers by deleting the workload pods, uninstalling the OpenShift sandboxed containers Operator, and deleting its resources.
You perform the following tasks:
Delete pods that use the
kata-remoteruntime class.ImportantYou must delete the workload pods before you delete the
KataConfigCR. The pod names usually have the prefixpodvmand custom tags, if provided. If you deploy confidential containers on a cloud provider and any resources remain after following these procedures, you might receive an unexpected bill for those resources from your cloud provider. Once you complete uninstalling OpenShift sandboxed containers on a cloud provider, check the cloud provider console to ensure that the procedures deleted all of the resources.-
Delete the
KataConfigcustom resource (CR). - Uninstall the OpenShift sandboxed containers Operator.
-
Delete the
KataConfigcustom resource definition (CRD).
6.1. Delete workload pods
You must delete your workload pods. The pod names usually have the prefix podvm and custom tags, if provided.
Prerequisites
-
You have installed the
jqutility.
Procedure
Search for the pods by running the following command:
$ oc get pods -A -o json | jq -r '.items[] | select(.spec.runtimeClassName == "kata-remote").metadata.name'
Delete each pod by running the following command:
$ oc delete pod <pod>
Verification
Verify that the pods using the
kata-remoteruntime class are no longer running by running the following command:$ oc get pods -A -o json | jq -r '.items[] | select(.spec.runtimeClassName == "kata-remote").metadata.name'
Confirm that the command returns no output.
Additional resources
6.2. Delete the KataConfig custom resource
You must delete the KataConfig custom resource (CR).
Deleting the KataConfig CR automatically reboots the worker nodes. Reboot can take from 10 to 60 minutes. The following factors can affect the reboot time:
- A larger OpenShift Container Platform deployment with a greater number of worker nodes.
- Activation of the BIOS and Diagnostics utility.
- Deployment on a hard drive rather than an SSD.
- Deployment on physical nodes such as bare metal, rather than on virtual nodes.
- A slow central processing unit (CPU) and network.
Prerequisites
-
You have deleted all pods that use the
kata-remoteruntime class.
Procedure
Delete the
KataConfigCR by running the following command:$ oc delete kataconfig example-kataconfig
The OpenShift sandboxed containers Operator removes all resources that were initially created to enable the runtime on your cluster.
ImportantWhen you delete the
KataConfigCR, the command-line interface (CLI) stops responding until all worker nodes reboot. You must wait for the deletion process to complete before performing the verification.
Verification
Confirm that the
KataConfigCR no longer exists by running the following command:$ oc get kataconfig example-kataconfig
Error from server (NotFound): kataconfigs.kataconfiguration.openshift.io "example-kataconfig" not found
Additional resources
6.3. Uninstall the OpenShift sandboxed containers Operator
You uninstall the OpenShift sandboxed containers Operator by using the command line.
Prerequisites
-
You have deleted all pods with the
kata-remoteruntime class.
Procedure
Delete the subscription by running the following command:
$ oc delete subscription sandboxed-containers-operator -n openshift-sandboxed-containers-operator
Delete the namespace by running the following command:
$ oc delete namespace openshift-sandboxed-containers-operator
Additional resources
6.4. Delete the KataConfig CRD
You must delete the KataConfig custom resource definition (CRD).
Procedure
Delete the
KataConfigCRD by running the following command:$ oc delete crd kataconfigs.kataconfiguration.openshift.io
Verification
Confirm that the
KataConfigCRD no longer exists by running the following command:$ oc get crd kataconfigs.kataconfiguration.openshift.io
Error from server (NotFound): customresourcedefinitions.apiextensions.k8s.io "kataconfigs.kataconfiguration.openshift.io" not found
Additional resources
Chapter 7. Observability
You can monitor the health of your confidential containers environment.
The following tools are available:
- OpenShift Container Platform web console. Administrators can access and query raw metrics through Prometheus.
- Logging
7.1. Metrics
You can monitor system health by querying metrics displayed in the OpenShift Container Platform web console.
You can access the following metrics:
- Kata agent metrics
-
Kata agent metrics display information about the kata agent process running in the virtual machine (VM) embedded in your sandboxed containers. These metrics include data from
/proc/<pid>/[io, stat, status]. - Kata guest operating system metrics
-
Kata guest operating system metrics display data from the guest operating system running in your sandboxed containers. These metrics include data from
/proc/[stats, diskstats, meminfo, vmstats]and/proc/net/dev. - Hypervisor metrics
-
Hypervisor metrics display data regarding the hypervisor running the VM embedded in your sandboxed containers. These metrics mainly include data from
/proc/<pid>/[io, stat, status]. - Kata monitor metrics
- Kata monitor is the process that gathers metric data and makes it available to Prometheus. The kata monitor metrics display detailed information about the resource usage of the kata-monitor process itself. These metrics also include counters from Prometheus data collection.
- Kata containerd shim v2 metrics
-
Kata containerd shim v2 metrics display detailed information about the kata shim process. These metrics include data from
/proc/<pid>/[io, stat, status]and detailed resource usage metrics.
7.2. View OpenShift sandboxed containers metrics
You can access the metrics for OpenShift sandboxed containers in the Metrics page in the OpenShift Container Platform web console.
Prerequisites
-
You have access to the cluster as a user with the
cluster-adminrole or with view permissions for all projects.
Procedure
- In the OpenShift Container Platform web console, navigate to Observe → Metrics.
In the input field, enter the query for the metric you want to observe.
All kata-related metrics begin with kata. Typing kata displays a list of all available kata metrics.
The metrics from your query are visualized on the page.
Troubleshooting
If no metrics are shown, verify that the query begins with
kataand confirm that OpenShift sandboxed containers workloads are running. To do so, check whether any pods use akataruntime class:$ oc get pods -A -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.spec.runtimeClassName}{"\n"}{end}' | grep kataIf no pods are using a
kataruntime class, the cluster generates no OpenShift sandboxed containers metrics.
7.3. Enable debug logs for CRI-O runtime
You can enable debug logs by updating the logLevel field in the KataConfig custom resource (CR). This changes the log level in the Container Runtime Interface (CRI-O) runtime for the worker nodes running OpenShift sandboxed containers.
Prerequisites
-
You have access to the cluster as a user with the
cluster-adminrole.
Procedure
Change the
logLevelfield in your existingKataConfigCR todebug:$ oc patch kataconfig <kataconfig> --type merge --patch '{"spec":{"logLevel":"debug"}}'Monitor the
kata-ocmachine config pool until the value ofUPDATEDisTrue, indicating that all worker nodes are updated:$ oc get mcp kata-oc
Example output
NAME CONFIG UPDATED UPDATING DEGRADED MACHINECOUNT READYMACHINECOUNT UPDATEDMACHINECOUNT DEGRADEDMACHINECOUNT AGE kata-oc rendered-kata-oc-169 False True False 3 1 1 0 9h
Verification
Start a debug session with a node in the machine config pool:
$ oc debug node/<node_name>
Change the root directory to
/host:# chroot /host
Verify the changes in the
crio.conffile:# crio config | egrep 'log_level
Example output
log_level = "debug"
Additional resources
7.4. View debug logs for OpenShift sandboxed containers components
Cluster administrators can use the debug logs to troubleshoot issues. The logs for each node are printed to the node journal.
You can review the logs for the following OpenShift sandboxed containers components:
- Kata agent
-
Kata runtime (
containerd-shim-kata-v2) -
virtiofsd
Quick Emulator (QEMU) only generates warning and error logs. These warnings and errors print to the node journal in both the Kata runtime logs and the Container Runtime Interface (CRI-O) logs with an extra qemuPid field.
Example of QEMU logs:
Mar 11 11:57:28 openshift-worker-0 kata[2241647]: time="2023-03-11T11:57:28.587116986Z" level=info msg="Start logging QEMU (qemuPid=2241693)" name=containerd-shim-v2 pid=2241647 sandbox=d1d4d68efc35e5ccb4331af73da459c13f46269b512774aa6bde7da34db48987 source=virtcontainers/hypervisor subsystem=qemu Mar 11 11:57:28 openshift-worker-0 kata[2241647]: time="2023-03-11T11:57:28.607339014Z" level=error msg="qemu-kvm: -machine q35,accel=kvm,kernel_irqchip=split,foo: Expected '=' after parameter 'foo'" name=containerd-shim-v2 pid=2241647 qemuPid=2241693 sandbox=d1d4d68efc35e5ccb4331af73da459c13f46269b512774aa6bde7da34db48987 source=virtcontainers/hypervisor subsystem=qemu Mar 11 11:57:28 openshift-worker-0 kata[2241647]: time="2023-03-11T11:57:28.60890737Z" level=info msg="Stop logging QEMU (qemuPid=2241693)" name=containerd-shim-v2 pid=2241647 sandbox=d1d4d68efc35e5ccb4331af73da459c13f46269b512774aa6bde7da34db48987 source=virtcontainers/hypervisor subsystem=qemu
The Kata runtime prints Start logging QEMU when QEMU starts, and Stop Logging QEMU when QEMU stops. The error appears in between these two log messages with the qemuPid field. The actual error message from QEMU appears in red.
The console of the QEMU guest is printed to the node journal as well. You can view the guest console logs together with the Kata agent logs.
Prerequisites
-
You have workloads running with the
kata-remoteruntime class. -
You have access to the cluster as a user with the
cluster-adminrole.
Procedure
To review the Kata agent logs and guest console logs, run the following command:
$ oc debug node/<nodename> -- journalctl -D /host/var/log/journal -t kata -g “reading guest console”
To review the Kata runtime logs, run the following command:
$ oc debug node/<nodename> -- journalctl -D /host/var/log/journal -t kata
To review the
virtiofsdlogs, run the following command:$ oc debug node/<nodename> -- journalctl -D /host/var/log/journal -t virtiofsd
To review the QEMU logs, run the following command:
$ oc debug node/<nodename> -- journalctl -D /host/var/log/journal -t kata -g "qemuPid=\d+"
NoteThis command uses a Perl-compatible regular expression (PCRE). If the command returns no output, confirm that QEMU is in use on the node before assuming a pattern-matching failure.
Verification
-
Verify that the output of each
oc debugcommand in the previous steps contains timestamped log entries with alevel=field. This indicates that the component is logging to the node journal. -
If a command returns no output, verify that the node is running workloads that use the
kata-remoteruntime class, or that QEMU is in use on the node before assuming a pattern-matching failure.
Chapter 8. Troubleshooting
You can open a Red Hat support case and provide debugging information by using must-gather. The must-gather tool collects diagnostic information about your OpenShift Container Platform cluster, including virtual machines and other data.
8.1. Use the must-gather utility
If you must open a Red Hat support case, you must use the must-gather utility to collect diagnostic information about your OpenShift Container Platform cluster, including virtual machines and other data. The oc adm must-gather command collects the information from your cluster for debugging issues, including resource definitions and service logs. By default, the oc adm must-gather command uses the default plugin image and writes into ./must-gather.local.
To collect data related to one or more specific features, use the
--imageargument:$ oc adm must-gather --image=registry.redhat.io/openshift-sandboxed-containers/osc-must-gather-rhel9:1.13.1
To collect audit logs, use the
-- /usr/bin/gather_audit_logsargument:$ oc adm must-gather -- /usr/bin/gather_audit_logs
NoteAudit logs are not collected as part of the default set of information to reduce the size of the files.
When you run
oc adm must-gather, a new pod with a random name is created in a new project on the cluster. The data is collected on that pod and saved in a new directory that starts withmust-gather.local. This directory is created in the current working directory.NAMESPACE NAME READY STATUS RESTARTS AGE ... openshift-must-gather-5drcj must-gather-bklx4 2/2 Running 0 72s openshift-must-gather-5drcj must-gather-s8sdh 2/2 Running 0 72s ...
Optionally, you can run the
oc adm must-gathercommand in a specific namespace by using the--run-namespaceoption.$ oc adm must-gather --run-namespace <namespace> --image=registry.redhat.io/openshift-sandboxed-containers/osc-must-gather-rhel9:1.13.1
Chapter 9. KataConfig status messages
The following table displays the status messages for the KataConfig custom resource (CR) for a cluster with two worker nodes.
Table 9.1. KataConfig status messages
| Status | Description |
|---|---|
| Initial installation
When a |
conditions:
message: Performing initial installation of kata-remote on cluster
reason: Installing
status: 'True'
type: InProgress
kataNodes:
nodeCount: 0
readyNodeCount: 0 |
| Installing Within a few seconds the status changes. |
kataNodes: nodeCount: 2 readyNodeCount: 0 waitingToInstall: - worker-0 - worker-1 |
| Installing (Worker-1 installation starting)
For a short period of time, the status changes, signifying that one node has initiated the installation of |
kataNodes: installing: - worker-1 nodeCount: 2 readyNodeCount: 0 waitingToInstall: - worker-0 |
| Installing (Worker-1 installed, worker-0 installation started)
After some time, |
kataNodes: installed: - worker-1 installing: - worker-0 nodeCount: 2 readyNodeCount: 1 |
| Installed
When installed, both workers are listed as installed, and the |
conditions:
message: ""
reason: ""
status: 'False'
type: InProgress
kataNodes:
installed:
- worker-0
- worker-1
nodeCount: 2
readyNodeCount: 2 |
| Status | Description |
|---|---|
| Initial uninstall
If |
conditions:
message: Removing kata-remote from cluster
reason: Uninstalling
status: 'True'
type: InProgress
kataNodes:
nodeCount: 0
readyNodeCount: 0
waitingToUninstall:
- worker-0
- worker-1 |
| Uninstalling After a few seconds, one of the workers starts uninstalling. |
kataNodes: nodeCount: 0 readyNodeCount: 0 uninstalling: - worker-1 waitingToUninstall: - worker-0 |
| Uninstalling Worker-1 finishes and worker-0 starts uninstalling. |
kataNodes: nodeCount: 0 readyNodeCount: 0 uninstalling: - worker-0 |
The reason field can also report the following causes:
-
Failed: This is reported if the node cannot finish its transition. ThestatusreportsTrueand themessageisNode <node_name> Degraded: <error_message_from_the_node>. -
BlockedByExistingKataPods: This is reported if there are pods running on a cluster that use thekata-remoteruntime whilekata-remoteis being uninstalled. Thestatusfield isFalseand themessageisExisting pods using "kata-remote" RuntimeClass found. Please delete the pods manually for KataConfig deletion to proceed. There could also be a technical error message reported likeFailed to list kata pods: <error_message>if communication with the cluster control plane fails.