Custom Linux OS image import reference architecture on GDC air-gapped

This document defines the reference architecture for importing, preparing, and registering custom enterprise Linux operating system images (Red Hat Enterprise Linux 8.10 and 9.6, Ubuntu 24.04 LTS, Oracle Linux, SUSE Linux Enterprise Server, and Debian) as reusable VirtualMachineImage resources in a Google Distributed Cloud (GDC) air-gapped tenant project. By establishing a shared OS image component, downstream application and infrastructure guides consume a verified VirtualMachineImage contract (components/custom-linux-os-images/<variant>/env.d/linux-vm-images.sh) instead of duplicating raw disk upload and VirtualMachineImageImport procedures.

The following diagram illustrates the offline OS image customization, object storage staging, VirtualMachineImageImport custom resource translation modes, and deployed Linux guest VM architecture:

Custom Linux OS image import architecture showing workstation bake, object storage staging, VirtualMachineImageImport modes, and deployed Linux guest VM.

Assumptions and limitations

  • This architecture requires GDC air-gapped 1.16.2-hf1 (1.16.2-gdch.1353-1) or later and VM Manager enabled in the target zone.
  • GDC air-gapped 1.16.2 ships ubuntu-2004, ubuntu-2204, ubuntu-2404, and rocky-linux-8 as out-of-the-box system VM images in the vm-system namespace. Enterprise workloads that require RHEL 8.10 or 9.6, hardened DISA STIG images, pre-baked package baselines (such as PostgreSQL 17 from PGDG), or vendor virtual appliances must import a custom qcow2 disk into the tenant project namespace.
  • gdcloud compute images import defaults to prepareImage: true, which boots a temporary preparation pod to install GDC guest agents and requires organization package repository access (http://pkg.org.internal). In disconnected zones without an in-enclave RHEL mirror, or when importing Ubuntu 24.04 images with pre-baked packages not carried by pkg.org.internal, custom images must be pre-configured offline with cloud-init, chrony, administrative credentials (and optionally qemu-guest-agent or gdc-guest-agent) before upload and imported using VirtualMachineImageImport (virtualmachine.gdc.goog/v1) with prepareImage: false. Standard Ubuntu main packages (such as nfs-kernel-server) can also be installed at runtime from pkg.org.internal when the mirror is available and enabled.
  • RHEL 9 import rejection and garden-linux translation bypass: GDC air-gapped admission webhooks in releases 1.16 and 1.17 reject operatingSystem: rhel-9 at import. Don't label an Enterprise Linux 9 (EL9) disk as rhel-8. Labeling an EL9 disk as rhel-8 runs the platform RHEL 8 preparation job, which installs Enterprise Linux 8 (EL8) packages from the organization package mirror into the EL9 disk; the import fails where the mirror is unavailable and otherwise leaves a mismatched OS. Instead, import RHEL 9 images with operatingSystem: garden-linux (manual mode) until native RHEL 9 support is available. Because the platform treats Garden Linux as an immutable system, this label acts as a manual mode switch that bypasses automated guest agent injection and package installation.
  • cloud-init and platform startup scripts: Linux platform startupScripts run only when cloud-init is installed and configured with datasource_list: [NoCloud, None] in a file under /etc/cloud/cloud.cfg.d/. Platform startup scripts run on every boot, so write all startup scripts idempotently.
  • Guest agent support on unsupported distributions: Installing the gdc-guest-agent RPM on distributions not natively supported by the platform (including RHEL 9) is best effort: in lab testing, the 1.16 RPM synchronized on RHEL 9.6 but failed to synchronize on RHEL 9.8. Plan user and SSH key provisioning through cloud-init.
  • VirtualMachineExternalAccess guidance: In release 1.16.2, VirtualMachineExternalAccess (VMEA) is no longer the preferred option, and configuring VMEA in the GDC console is deprecated (create an External Load Balancer for ingress and a Cloud NAT gateway for egress instead, or configure VMEA using the VMM API or gdcloud CLI). Protect administrative access with a ProjectNetworkPolicy custom resource scoped strictly to the administrator or jump host CIDR block, and never 0.0.0.0/0, enforcing key-only SSH.

Architecture

This section describes the offline customization pipeline, image import path, golden image generalization steps, and virtual disk sizing profiles.

Image staging and import pipeline

The custom Linux image pipeline operates entirely within the tenant project boundary on the management API server:

  • Start from a vendor Kernel-based Virtual Machine (KVM) guest image: Prefer vendor KVM guest images (such as rhel-9.6-x86_64-kvm.qcow2 or rhel-8.10-x86_64-kvm.qcow2) over ISO or Kickstart builds. These images already include virtio drivers, cloud-init, and serial console configuration.
  • Source file hygiene: Decompress .gz or .xz archives, flatten backing chains with qemu-img convert -O qcow2, and set minimumDiskSize in binary units (Gi) at least as large as the virtual disk size (at least 20% larger is recommended). Upload each import attempt under a unique object name because reusing an object name already consumed by an earlier import stalled the import in testing.
  • Offline customization and Security-Enhanced Linux (SELinux) relabeling: When customizing an image offline (by using virt-customize or qemu-nbd chroot) to configure Network Time Protocol (NTP) time servers (/etc/chrony.conf), cloud-init data source settings, or temporary credentials, run virt-customize --selinux-relabel or create /.autorelabel on the image so files modified from chroot get correct SELinux labels on enforcing distributions.
  • Object storage scratch bucket (vm-images-bucket): GDC VM Manager reads source disk objects from a project-scoped Bucket custom resource named vm-images-bucket. The project-vm-image-admin role gives read and write access to vm-images-bucket, and binding a bucket-access role (such as project-bucket-object-admin or project-vm-image-admin) triggers the object storage controller to provision your S3 credentials in the object-storage-access-keys namespace after a Bucket custom resource exists in the project.
  • Declarative Import and API Alternative (VirtualMachineImageImport): The gdcloud compute images import CLI doesn't expose prepareImage. With the declarative Kubernetes Resource Model (KRM) API, create a VirtualMachineImageImport with prepareImage: false (operatingSystem: garden-linux for RHEL 9 or operatingSystem: ubuntu-2404 for Ubuntu 24.04 LTS) to stream the qcow2 object from vm-images-bucket into a persistent VirtualMachineImage resource (rhel-9-6-custom, rhel-8-10-custom, or ubuntu-2404-custom).
  • Golden Image Capture Pipeline and Generalization: To capture a reusable golden image from a prepared boot disk, use VirtualMachineImageImport with spec.source.diskRef.name referencing the boot disk of a cleanly stopped preparation VM. Before shutdown, generalize the VM: remove personal accounts, temporary SSH keys, and the temporary root password, run cloud-init clean --logs --seed, empty /etc/machine-id, and delete /etc/ssh/ssh_host_*. Otherwise, every child VM created from the image shares the same machine ID, host keys, and access credentials.
  • Isolated Environment Contract (components/custom-linux-os-images/<variant>/env.d/linux-vm-images.sh): Once the VirtualMachineImageImport custom resource reports Ready=True and creates the VirtualMachineImage, the selected reference implementation writes ${HOME}/gdcag-solutions/components/custom-linux-os-images/rhel/env.d/linux-vm-images.sh (exporting GDCS_RHEL9_IMAGE_NAME and GDCS_RHEL8_IMAGE_NAME) or ${HOME}/gdcag-solutions/components/custom-linux-os-images/ubuntu/env.d/linux-vm-images.sh (exporting GDCS_UBUNTU2404_IMAGE_NAME) inside its own component directory.

Sizing and storage footprint

Image Profile Source Format Virtual Size Recommended minimumDiskSize Target operatingSystem Label Exported Contract Variable
RHEL 9.6 KVM Guest Image qcow2 10 GiB 20Gi garden-linux GDCS_RHEL9_IMAGE_NAME="rhel-9-6-custom"
RHEL 8.10 KVM Guest Image qcow2 10 GiB 20Gi rhel-8 GDCS_RHEL8_IMAGE_NAME="rhel-8-10-custom"
Ubuntu 24.04 LTS Cloud Image qcow2 3.5 GiB to 6.5 GiB 20Gi ubuntu-2404 GDCS_UBUNTU2404_IMAGE_NAME="ubuntu-2404-custom"
Vendor Appliance Image qcow2 40 GiB to 250 GiB Virtual size + 20% ubuntu-2204, ubuntu-2404, or rhel-8 Workload-specific GDCS_*_IMAGE_NAME

Security and identity boundaries

  • Principle of least privilege: Importing custom VM images requires only project-scoped roles (project-vm-image-admin and project-bucket-object-admin) on the management API server. No organization-wide privileges are required.
  • Post-import object cleanup: After the VirtualMachineImageImport custom resource reaches Ready=True and creates the VirtualMachineImage, the raw qcow2 object in vm-images-bucket is no longer referenced and can be removed to reclaim object storage capacity.
  • Network firewall and administrative access: Initial administrative access is available through the GDC serial console or through a ProjectNetworkPolicy (PNP) custom resource admitting port 22. In release 1.16.2, VirtualMachineExternalAccess is no longer the preferred option, and configuring it in the GDC console is deprecated. Scope the ProjectNetworkPolicy ingress rule strictly to the administrator or jump host CIDR range, never 0.0.0.0/0, enforce key-only SSH, and remove the port 22 rule after the VM is configured.

What's next

For implementation steps and related VM documentation, see the following resources: