Appendix · Kubernetes patterns on OpenShift

The patterns, worked on OpenShift with our own services.

A chapter per pattern across the six families of cloud-native Kubernetes design (foundational, structural, behavioral, configuration, advanced, and security), each worked on OpenShift with the guide's shipping services instead of a textbook's toy app. Every manifest satisfies restricted-v2, services face the host through Routes, and the operator and image-builder patterns use OperatorHub and the integrated registry.

It's the OpenShift corollary to the minikube Kubernetes-patterns appendix. Every chapter carries a DO280/EX280 exam lens and an Explore with your agent call-out, and a runnable example under examples/appendix-patterns/.

The set

Read a family at a time. Each chapter is self-contained: the pattern, why it matters, the restricted-v2 manifests worked against a shipping service, cleanup, and a pointer to the runnable example.

Start here

00 Kubernetes patterns on OpenShift: start here

The map: the six pattern families, how each chapter is built, the two call-outs, and how the set reconciles against the DO280/EX280 exam.

Foundational

01 Predictable Demands

Declare what a container needs to run on OpenShift: CPU and memory requests and limits under restricted-v2, a PriorityClass, and the ConfigMaps and PersistentVolumeClaims it can't start without.

Foundational

02 Declarative Deployment

Roll a new version out on OpenShift with a Deployment's RollingUpdate and Recreate strategies, verified against a Route with a live curl loop, then compare them with oc rollout status, history, and undo.

Foundational

03 Health Probe

Separate liveness from readiness with startup, liveness, and readiness probes on OpenShift, then add a readiness gate that only an external signal can satisfy.

Foundational

04 Managed Lifecycle

Honor the container lifecycle contract on OpenShift: postStart and preStop hooks, SIGTERM to PID 1, and a terminationGracePeriodSeconds that backstops a graceful shutdown.

Foundational

05 Automated Placement

Steer the scheduler on OpenShift with nodeSelector, node and pod affinity, and taints and tolerations, and understand how replica spreading works on a single-node CRC cluster.

Structural

06 Init Container

Run ordered pre-start setup in a container that must finish before the main container starts, worked on OpenShift against notification-service's real Alembic migration under restricted-v2.

Structural

07 Sidecar

Run a helper container beside the app in one Pod on OpenShift, sharing its network and a volume, using the native sidecar mechanism for a correct startup and shutdown order.

Structural

08 Adapter

Normalize an application's own output into a standard interface with a sidecar on OpenShift, translating shipping-service's JSON health body into Prometheus exposition text.

Structural

09 Ambassador

Broker an application's outbound connection through a localhost proxy sidecar on OpenShift, letting shipping-service reach Postgres with no Postgres-aware environment variable at all.

Behavioral

10 Batch Job

Run work to completion instead of forever on OpenShift with a Job's completions and parallelism, then partition a dataset deterministically with an Indexed Job.

Behavioral

11 Periodic Job

Wrap a Job in a CronJob to run it on a schedule on OpenShift, and reason about concurrencyPolicy, startingDeadlineSeconds, suspend, and history limits instead of a crontab on a server.

Behavioral

12 Daemon Service

Run exactly one infrastructure Pod per node with a DaemonSet on OpenShift, and work through the two layers (SCC and SELinux) that gate reading a node's own filesystem.

Behavioral

13 Singleton Service

Protect a single-instance service from voluntary disruption on OpenShift with a PodDisruptionBudget, and learn exactly which operations it governs and which it doesn't.

Behavioral

14 Stateless Service

Name the default shape most services should take on OpenShift: interchangeable Pods with no stable identity and no per-Pod storage, scaled horizontally through an ordinary Deployment.

Behavioral

15 Stateful Service

Give a workload stable per-Pod identity and sticky storage on OpenShift with a StatefulSet and a headless Service, under the nonroot-v2 SCC its database image needs.

Behavioral

16 Service Discovery

Reach a workload by a name that outlives any Pod on OpenShift: ClusterIP, NodePort, and LoadBalancer Services, CoreDNS, and external access through a Route (and the Ingress that becomes one).

Behavioral

17 Self Awareness

Let a container read its own Pod's metadata, identity, and declared resources on OpenShift through the Downward API, as environment variables and as a volume that updates in place.

Configuration

18 Env Var Configuration

Populate a container's environment on OpenShift from three sources at once: a literal, a ConfigMap key, and a Secret key, and understand why none of them update a running container.

Configuration

19 Configuration Resource

Bulk-expose a ConfigMap or Secret as environment variables with envFrom on OpenShift, mount the same resource as files at once, and see why one half updates live and the other doesn't.

Configuration

20 Configuration Template

Render a structured config file from a template and an environment overlay with an init container on OpenShift, for configuration shapes a flat environment variable can't express.

Configuration

21 Immutable Configuration

Mark a ConfigMap immutable on OpenShift, watch the API server reject an in-place edit, and roll a config change the only way an immutable resource allows: a new name and a new rollout.

Advanced

22 Controller

The reconcile loop every controller shares: watch an object, compute the difference between its current and desired state, and act on only that difference, whether the controller ships with OpenShift or is code you wrote yourself.

Advanced

23 Elastic Scale

Three ways to change a workload's replica count without a human running oc scale: an HPA and a VPA reading the Pods themselves, and the Custom Metrics Autoscaler reading an external signal instead, which is the only path to zero.

Advanced

24 Image Builder

Build a container image with no Docker Engine on the host and no privileged container in the cluster: OpenShift Builds run Buildah inside a Pod, from a local directory or straight from a git commit, and push to the integrated registry a Deployment pulls from.

Advanced

25 Operator

A CRD and a controller together, packaging an application's own operational knowledge as an OpenShift API: the ShippingPolicy operator, built from scratch in Go with controller-runtime and run under restricted-v2.

Security

26 Access Control

Give a workload its own ServiceAccount, grant it exactly the ConfigMap and Secret reads it needs with a Role and RoleBinding, and prove the boundary with oc auth can-i.

Security

27 Network Segmentation

Deny all ingress to a service by default, allow only the one caller that legitimately needs it, and restrict egress to the destinations a workload talks to, with NetworkPolicy on OpenShift's OVN-Kubernetes.

Security

28 Process Containment

Drop every Linux capability a container doesn't name, make its root filesystem read-only, run it non-root, and let OpenShift's restricted-v2 SCC inject the UID and enforce the floor, with Pod Security Admission as a second layer.

Security

29 Secure Configuration

Treat a Secret as a credential, not a ConfigMap with a different name: know what base64 doesn't do, read a Secret two ways under an arbitrary UID, and survey where to go once a raw Secret isn't enough.

Operations

30 Observability and Debugging

oc's windows into a running Pod: logs (-p, -c, -f), exec, port-forward, describe, get events, and the two debuggers OpenShift gives you, oc debug's pod copy and kubectl debug's ephemeral container under restricted-v2.

Operations

31 Packaging: Helm and Kustomize

Deploy the same shipping-service two ways: a Helm chart with install/upgrade/rollback, and a Kustomize base with dev and prod overlays, no templating, just patches, both rendered and applied with oc.

Operations

32 Namespace Governance

The namespace-level complement to a Pod's own resource declarations: ResourceQuota caps a namespace's total, LimitRange defaults and bounds every container, and OpenShift's ClusterResourceQuota extends the cap across projects.

Crosswalk

33 DO280/EX280 Crosswalk

The closing reference: every chapter in this appendix mapped to its DO280/EX280 objective area, a per-objective coverage summary, and a timed self-test against the shipping services on CRC.

Where this fits in the guide

This appendix is reached from §18 of the main guide. The earlier chapters stood up the cluster and its building blocks: deploying, Routes, Helm, Operators, and the §17 data mesh wired them into one running system. This appendix steps back and names the patterns behind those pieces, one at a time, with the DO280/EX280 exam as a second lens.

The examples run on a pristine CRC cluster; the host prerequisites are the same as §1. This is the OpenShift corollary to the minikube Kubernetes-patterns appendix, which works the same patterns on plain Kubernetes.