LearnwithVishnu
LearnwithVishnu
Basics → Production → Architect
← Home
🔴OpenShift
BeginnerEngineerProductionArchitectEnterprise Kubernetes — SCC, Routes, Operators, OLM, MachineConfig
What is OCPProjects & RoutesSCCOperatorsTroubleshootInterview Q&A

🔴 What is OpenShift?

OpenShift vs Kubernetes

FeatureKubernetes (vanilla)OpenShift (OCP)
Pod securityPod Security Admission (optional)SCC — enforced, cannot disable
HTTP routingIngress resourceRoute resource (HAProxy backed)
Operator frameworkNot built-inOLM + OperatorHub built-in
Container registryNot includedInternal registry included
Node OSAny LinuxRed Hat CoreOS (immutable, operator-managed)
Web consoleBasic (dashboard)Full-featured developer + admin views
CLIkubectloc (kubectl + OCP extensions)
SupportCommunityRed Hat enterprise support
OpenShift version check + cluster health

📁 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.

Deploy app + Routes + essential oc commands

🔐 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)

SCCAllowsUse for
restrictedRandom UID, no root, no host accessDefault — all well-written containers
nonrootAny non-root UIDApps needing specific UID but not root
anyuidAny UID including rootLegacy apps — use only if necessary
hostnetworkHost network namespaceNetwork tools, CNI plugins
privilegedEverythingNode agents (Datadog, Filebeat DaemonSets)
SCC diagnosis and fix — complete workflow

⚙️ 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.

Install operator via OLM + MachineConfig

🔍 Troubleshooting

SCC errors, ClusterOperator degraded, node issues, etcd

🔄 OpenShift vs AKS — Production Comparison

When to choose OpenShift, when to choose AKS

OpenShift (OCP)AKS
Security defaultLocked down — no root, SCC enforced, requires explicit permissionsMore permissive — teams must configure security themselves
Operator modelFirst-class — OperatorHub has 500+ operatorsAvailable via Helm, less integrated
Developer experienceBuilt-in CI/CD (Tekton), image builds (S2I), developer consoleBare K8s — bring your own CI/CD
Enterprise supportRed Hat support contract — single vendorAzure support — Microsoft backed
CostHigher — OpenShift subscription + computeLower — just compute + Azure managed control plane
Regulated industriesCommon in banking, telco, healthcare — security by defaultGrowing — with Azure Policy + Defender
Multi-cloudRuns on AWS, Azure, GCP, on-prem identicallyAzure only

OpenShift concepts that map to Kubernetes

OpenShiftKubernetes equivalentKey difference
ProjectNamespaceProject has built-in network isolation and admin role
RouteIngressRoute is simpler, built-in TLS, HAProxy by default
DeploymentConfigDeploymentLegacy OCP — use Deployment in OCP 4.x instead
SCCPodSecurityPolicy (deprecated)SCC is more flexible and actively maintained in OCP
ImageStreamNo equivalentTracks image tags, triggers deployments on new tags
BuildConfig / S2INo equivalentSource-to-image builds inside OpenShift
OperatorHubHelm 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.

🎯 Interview Questions

OPENSHIFT · ENGINEER
How is OpenShift different from vanilla Kubernetes?
OpenShift adds enterprise security, operational tooling, and developer workflow on top of Kubernetes. Key differences: Security Context Constraints enforce that pods cannot run as root by default — stricter than vanilla K8s PodSecurityPolicy or Pod Security Admission. Routes are OpenShift's native HTTP routing resource (backed by HAProxy router) — richer TLS options than Kubernetes Ingress. Operator Lifecycle Manager is built-in for managing complex application lifecycle. Internal container registry is included out of the box. Image Streams are an OCP-native concept that automatically triggers deployments when an upstream image is updated. The oc CLI extends kubectl with OpenShift-specific commands. Web console has both developer and administrator perspectives. From an operational standpoint: OpenShift clusters are more opinionated and harder to customise than vanilla Kubernetes, but enterprise features (RBAC, audit logging, built-in registry, operator framework) save significant setup time. At HPE we ran OCP 4.x for the telecom SRO/COM/NBI platform — the SCC enforcement and Operator-based deployment model suited our enterprise compliance requirements.
OPENSHIFT · PRODUCTION
A pod fails with SCC error in OpenShift. Walk through the fix.
SCC (Security Context Constraints) error means the pod is requesting privileges that no assigned SCC allows. Step 1: read the error message carefully. oc describe pod failing-pod shows the exact SCC violation — usually running as root UID (0), using hostPath volumes, or requesting host network. Step 2: check what SCCs the pod's service account can use. oc adm policy scc-review -z service-account-name -n namespace. Step 3: choose the right fix. Correct fix: update the container to run as non-root. Add USER 1001 to the Dockerfile. This makes the container work with the default restricted SCC — no privilege escalation needed. Workaround for legacy apps: create a dedicated service account, grant the minimum SCC needed (nonroot before anyuid), use that service account in the deployment. Never use anyuid in production without a valid reason and never use privileged unless it is a node-level DaemonSet. Step 4: verify the fix. oc get pod fixed-pod -o jsonpath shows which SCC was assigned. At HPE: legacy telecom apps (TeMIP) needed anyuid because they were built to run as root. We isolated them in a dedicated namespace with tighter network policies to compensate.
OPENSHIFT · ARCHITECT
Explain OpenShift Operators and why they matter.
An Operator is a Kubernetes controller that encodes the operational knowledge of running a complex application. Instead of a human manually creating replicas, running backups, handling failover, and managing upgrades, an Operator does all of this automatically by watching custom resources. Example: a PostgreSQL Operator watches PostgreSQLCluster objects. When you create one, the Operator creates the StatefulSet, creates users, configures replication, sets up monitoring, schedules backups, and handles failover — things that would take hours of manual work. In OpenShift, Operator Lifecycle Manager is built-in and OperatorHub provides a catalogue of certified operators. Key objects: Subscription (which operator, which channel, auto or manual upgrade), ClusterServiceVersion (installed operator version + capabilities), InstallPlan (pending upgrades waiting for approval). Production best practice: always use Manual approval for operators in production. Auto-upgrade can break things. With Manual, you review the upgrade notes and approve during a maintenance window. At HPE: we used the OpenShift GitOps Operator (ArgoCD) and the Prometheus Operator — both managed through OLM with manual upgrade approval.
OPENSHIFT · ENGINEER
What is the difference between a Route and an Ingress in OpenShift?
Route is OpenShift's native HTTP routing resource, backed by the HAProxy-based OpenShift Router. Ingress is the standard Kubernetes resource that also works in OpenShift but routes to the same underlying router. Key differences: Routes have more TLS options natively — edge (TLS terminates at router, plain HTTP to pod), passthrough (TLS passes through to pod, end-to-end encryption), and reencrypt (TLS to router, new TLS to pod). Routes support custom certificates per route without needing cert-manager. Route status shows the exact hostname assigned. Ingress in OpenShift is converted to a Route internally. Use Routes when you want OpenShift-native features or when using the oc CLI and web console. Use Ingress when you want portability across Kubernetes distributions or when using Helm charts designed for vanilla K8s. The hostname format for Routes: app-name-namespace.apps.cluster-domain — automatically assigned if not specified.
Continue Learning
☸️ Kubernetes🔧 Jenkins⚡ GitHub Actions🏠 All Topics
OPENSHIFT · ENGINEER
What is a Security Context Constraint (SCC) and how does it differ from Pod Security in vanilla Kubernetes?
SCC is OpenShift's mechanism for controlling pod security — what UID it can run as, whether it can access the host network/filesystem, what Linux capabilities it can use. Every pod must satisfy an SCC to be admitted. The default SCC (restricted) prevents running as root, prevents host access, prevents privilege escalation. When you deploy an application that needs a specific UID, you grant the appropriate SCC to its ServiceAccount: oc adm policy add-scc-to-sa anyuid -z my-service-account -n my-project. In vanilla Kubernetes: PodSecurityPolicy served a similar purpose but was deprecated in 1.21 and removed in 1.25, replaced by Pod Security Admission (PSA) — which has three modes: privileged, baseline, restricted, applied per namespace. OpenShift's SCC is more granular — per service account, not just per namespace. The practical difference at HPE: many third-party applications required anyuid SCC because they were built to run as root. In OpenShift, each of these needed explicit SCC grants. This forced a security audit of every third-party tool — a benefit, because it surfaced applications running with excessive privileges.
OPENSHIFT · ENGINEER
What is an Operator and how does it differ from a Helm chart?
A Helm chart packages Kubernetes manifests for deployment — it installs, upgrades, and removes resources. Day 1 operations. An Operator goes further — it is a controller that understands the application's operational domain and automates Day 2 operations. Helm installs a database. An Operator installs the database, monitors it, handles failover, manages backups, rotates credentials, and responds to failures based on domain knowledge encoded in the operator's logic. An Operator is built using the Operator SDK or Kubebuilder. It introduces a Custom Resource Definition (CRD) — for example, kind: PostgresCluster. You create an instance of that CRD and the Operator reconciles the cluster into the desired state continuously. In OpenShift: OperatorHub provides 500+ operators. Install the OpenShift Elasticsearch Operator and it manages your entire ELK stack as a first-class citizen. At HPE we used the OpenShift Service Mesh Operator (Istio) which managed all the Istio control plane components, certificates, and upgrades — what would have taken weeks of manual work was handled by the Operator.
OPENSHIFT · PRODUCTION
How does ArgoCD work on OpenShift? What are the OpenShift-specific considerations?
ArgoCD on OpenShift runs as pods in a dedicated namespace (usually openshift-gitops if using the Red Hat GitOps Operator). OpenShift-specific considerations: SCC — ArgoCD server pods need appropriate SCC permissions. The OpenShift GitOps Operator handles this automatically; installing ArgoCD manually requires granting SCCs. Routes instead of Ingress — ArgoCD UI is exposed via an OpenShift Route with TLS termination. RBAC integration — ArgoCD can integrate with OpenShift OAuth so engineers log into ArgoCD with their OpenShift credentials. Project/namespace isolation — ArgoCD Applications deploy into OpenShift Projects. The ArgoCD service account needs appropriate project permissions. At HPE for Vodafone DU: we used Red Hat OpenShift GitOps (ArgoCD). We had one ArgoCD Application per environment (dev, stage, prod), using the App-of-Apps pattern. The Application of Applications managed 15+ child Applications — one per microservice. Each child Application synced a Helm chart from the Git repo. Sync waves controlled order: infrastructure (databases, secrets) in wave 0, application services in wave 1, frontend in wave 2. Production sync required manual approval — automatic for dev.
OPENSHIFT · ARCHITECT
Explain the OpenShift multi-tenancy model in a large enterprise deployment.
OpenShift multi-tenancy works at two levels. Project-level isolation: each team or application gets its own Project (namespace). Network policies enforce that Project A pods cannot reach Project B pods by default. Each Project has its own resource quotas (max CPU, memory, PVC count) and LimitRanges (default requests/limits per pod). Project admins can manage resources within their Project but cannot see other Projects. Cluster-level governance: ClusterResourceQuota applies quotas across multiple Projects (useful when one team has multiple Projects). SCCs applied per service account — developers cannot escalate privileges in their Project. RBAC: cluster-admin for platform team, project-admin for team leads, edit for developers, view for auditors. At HPE for DU Vodafone: separate Projects for each deployment tier (dev, staging, UAT, production) and each major component (TeMIP, UOC, UTM, UCA). The network policy model prevented any cross-component traffic that wasn't explicitly allowed. During a security audit this model passed cleanly — every network flow was documented in NetworkPolicy YAMLs committed to Git.
🤖
AI Assistant
Ask anything about this topic
👋 Hi! I have read this page and can answer your questions.

Try asking: "Explain this topic in simple terms" or "Give me an example" or ask any specific question.