🔴 What is OpenShift?
›OpenShift vs Kubernetes
| Feature | Kubernetes (vanilla) | OpenShift (OCP) |
|---|---|---|
| Pod security | Pod Security Admission (optional) | SCC — enforced, cannot disable |
| HTTP routing | Ingress resource | Route resource (HAProxy backed) |
| Operator framework | Not built-in | OLM + OperatorHub built-in |
| Container registry | Not included | Internal registry included |
| Node OS | Any Linux | Red Hat CoreOS (immutable, operator-managed) |
| Web console | Basic (dashboard) | Full-featured developer + admin views |
| CLI | kubectl | oc (kubectl + OCP extensions) |
| Support | Community | Red Hat enterprise support |
📁 Projects, Deployments & Routes
›Projects vs Namespaces
An OpenShift Project is a Kubernetes namespace with extra metadata and automatic RBAC defaults. oc new-project is the correct way to create namespaces — it applies the cluster's project template including network policies, LimitRanges, and ResourceQuotas automatically.
🔐 SCC — Security Context Constraints
›Why SCC exists
In vanilla Kubernetes, containers can run as root by default. OpenShift blocks this. Every pod must match an SCC or it is rejected. This is the #1 source of friction when migrating apps from Kubernetes to OpenShift — and the #1 interview topic for OCP roles.
SCC Hierarchy (least to most privileged)
| SCC | Allows | Use for |
|---|---|---|
| restricted | Random UID, no root, no host access | Default — all well-written containers |
| nonroot | Any non-root UID | Apps needing specific UID but not root |
| anyuid | Any UID including root | Legacy apps — use only if necessary |
| hostnetwork | Host network namespace | Network tools, CNI plugins |
| privileged | Everything | Node agents (Datadog, Filebeat DaemonSets) |
⚙️ Operators & MachineConfig
›What an Operator actually does
Manual approach: you create StatefulSet, ConfigMap, Service, PodDisruptionBudget, CronJob for backups, monitoring rules — 10+ YAML files and ongoing operational toil. With an Operator: you create one custom resource (PostgreSQLCluster) and the Operator handles everything — provisioning, replication, backups, upgrades, failover. The Operator encodes the same knowledge a database DBA would have.
🔍 Troubleshooting
›🔄 OpenShift vs AKS — Production Comparison
›When to choose OpenShift, when to choose AKS
| OpenShift (OCP) | AKS | |
|---|---|---|
| Security default | Locked down — no root, SCC enforced, requires explicit permissions | More permissive — teams must configure security themselves |
| Operator model | First-class — OperatorHub has 500+ operators | Available via Helm, less integrated |
| Developer experience | Built-in CI/CD (Tekton), image builds (S2I), developer console | Bare K8s — bring your own CI/CD |
| Enterprise support | Red Hat support contract — single vendor | Azure support — Microsoft backed |
| Cost | Higher — OpenShift subscription + compute | Lower — just compute + Azure managed control plane |
| Regulated industries | Common in banking, telco, healthcare — security by default | Growing — with Azure Policy + Defender |
| Multi-cloud | Runs on AWS, Azure, GCP, on-prem identically | Azure only |
OpenShift concepts that map to Kubernetes
| OpenShift | Kubernetes equivalent | Key difference |
|---|---|---|
| Project | Namespace | Project has built-in network isolation and admin role |
| Route | Ingress | Route is simpler, built-in TLS, HAProxy by default |
| DeploymentConfig | Deployment | Legacy OCP — use Deployment in OCP 4.x instead |
| SCC | PodSecurityPolicy (deprecated) | SCC is more flexible and actively maintained in OCP |
| ImageStream | No equivalent | Tracks image tags, triggers deployments on new tags |
| BuildConfig / S2I | No equivalent | Source-to-image builds inside OpenShift |
| OperatorHub | Helm charts (partial) | Operators manage full application lifecycle |
SCC — Security Context Constraints (the most common OCP interview topic)
SCC is OpenShift's policy that controls what a pod is allowed to do: run as root, access host filesystem, use specific capabilities. Every pod in OpenShift must satisfy an SCC to run. Built-in SCCs from most to least restrictive: restricted (default — no root, no host access), nonroot (any non-root UID), anyuid (any UID including root), privileged (full host access — only for infrastructure pods). Real scenario: deploying a third-party application that requires running as root. In plain Kubernetes this just works (by default). In OpenShift: you must grant the anyuid SCC to the service account. Best practice: grant the minimum SCC needed. Prefer building images that run as non-root.