Cloud, Docker, Kubernetes & OpenShift

Senior Java / Spring Boot / Microservices — Interview Perspective Guide

Focus: one-line understanding, architecture, YAML, production flow, and senior-level interview answers.

AWSAzureGCP DockerKubernetesOpenShift HelmSecretsTLS

Quick Navigation

1. Big Picture — Remember This Architecture

Cloud (AWS / Azure / GCP) ↓ Container Registry ↓ Docker Image ↓ Kubernetes / OpenShift ↓ Cluster ↓ Node ↓ Pod ↓ Spring Boot Application ↓ Config / Secrets / Certificates ↓ Readiness / Liveness ↓ Service ↓ Ingress / OpenShift Route ↓ Load Balancer ↓ Client
Interview shortcut: Cloud provides infrastructure/services; Docker packages the application; Kubernetes orchestrates containers; OpenShift provides an enterprise Kubernetes platform; Service provides stable internal access; Ingress/Route exposes HTTP(S) externally.

2. AWS vs Azure vs GCP

ConceptAWSAzureGCPInterview Understanding
Cloud PlatformAWSMicrosoft AzureGoogle CloudCloud provider offering compute, storage, networking, databases, security, monitoring, etc.
VMEC2Azure VMCompute EngineVirtual machine for workloads requiring an OS.
KubernetesEKSAKSGKEManaged Kubernetes service.
Object StorageS3Blob StorageCloud StorageStores files/objects such as documents, images, backups.
Managed DBRDSAzure SQLCloud SQLManaged relational database service.
ServerlessLambdaAzure FunctionsCloud Functions / Cloud RunRun workloads without managing traditional servers.
SecretsSecrets ManagerKey VaultSecret ManagerCentralized storage and access control for sensitive values.
MonitoringCloudWatchAzure MonitorCloud MonitoringLogs, metrics, alerts and operational visibility.
Container RegistryECRACRArtifact RegistryStores Docker/container images.
Load BalancingELB / ALB / NLBAzure Load Balancer / App GatewayCloud Load BalancingDistributes incoming traffic across healthy targets.

3. Docker — Packaging the Spring Boot Application

One-line definition: Docker packages an application and its runtime dependencies into a portable container image.

TermMeaningInterview Example
DockerfileInstructions used to build an image.FROM, COPY, RUN, EXPOSE, ENTRYPOINT
ImageImmutable package/template used to create containers.order-service:1.2.0
ContainerRunning instance of an image.Running Order Service process.
RegistryRepository for container images.ECR / ACR / Artifact Registry
VolumePersistent/shared storage mechanism.Database or file workload storage.

Example Dockerfile

FROM eclipse-temurin:21-jre
WORKDIR /app
COPY target/order-service.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "app.jar"]
Interview answer: “We build the Spring Boot JAR with Maven, create a Docker image from the JAR, push that image to a registry, and Kubernetes pulls the image to run Pods.”

Container vs Virtual Machine

ContainerVM
Shares host OS kernel.Runs a guest operating system.
Lightweight and starts quickly.Generally heavier and slower to start.
Excellent for microservices and CI/CD.Useful when workload requires OS-level isolation.

4. Kubernetes — Core Concepts

One-line definition: Kubernetes is a container orchestration platform that manages deployment, scaling, networking, health, and self-healing of containerized applications.

Cluster → Node → Pod

TermOne-Line UnderstandingExample
ClusterComplete Kubernetes environment containing control plane and worker nodes.Production EKS cluster.
NodeWorker machine where Pods run.EC2-backed Kubernetes worker.
PodSmallest deployable Kubernetes unit containing one or more containers.Pod running order-service.
DeploymentMaintains desired Pod replicas and manages rolling updates/rollback.3 replicas of Order Service.
ServiceStable network endpoint for a changing set of Pods.order-service:80
IngressKubernetes HTTP/HTTPS routing resource.orders.example.com → Service
NamespaceLogical partition for organizing and isolating resources.dev / qa / prod
Easy memory trick: Pod runs the application → Node runs Pods → Cluster contains Nodes → Deployment manages Pods → Service finds/reaches Pods.

5. Kubernetes Deployment YAML

apiVersion: apps/v1
kind: Deployment
metadata:
  name: order-service
spec:
  replicas: 3
  selector:
    matchLabels:
      app: order-service
  template:
    metadata:
      labels:
        app: order-service
    spec:
      containers:
        - name: order-service
          image: order-service:1.0
          ports:
            - containerPort: 8080
SectionPurpose
apiVersionAPI version for the Kubernetes resource.
kindResource type, such as Deployment or Service.
metadataName, labels and identifying information.
spec.replicasDesired number of Pod replicas.
selectorIdentifies which Pods belong to the Deployment.
templateBlueprint used to create Pods.
containersContainer image, ports, resources, environment and probes.

Resources

resources:
  requests:
    cpu: "250m"
    memory: "512Mi"
  limits:
    cpu: "1"
    memory: "1Gi"

Interview point: Requests help Kubernetes schedule the Pod; limits cap the resources the container can consume.

6. Kubernetes Service

One-line definition: A Service gives a stable DNS/network endpoint and load-balances traffic to matching healthy Pods.

apiVersion: v1
kind: Service
metadata:
  name: order-service
spec:
  selector:
    app: order-service
  ports:
    - port: 80
      targetPort: 8080
Service TypeUse
ClusterIPDefault; internal cluster communication.
NodePortExposes service through a port on each Node.
LoadBalancerRequests an external load balancer from the cloud provider.
ExternalNameMaps a service name to an external DNS name.

7. Ingress vs OpenShift Route

Kubernetes Ingress

One-line definition: Ingress provides HTTP/HTTPS routing from outside the cluster to Kubernetes Services through an Ingress Controller.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: order-ingress
spec:
  rules:
    - host: orders.example.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: order-service
                port:
                  number: 80

OpenShift Route

One-line definition: An OpenShift Route is an OpenShift-specific resource for exposing a Service externally over HTTP/HTTPS, including TLS termination options.

apiVersion: route.openshift.io/v1
kind: Route
metadata:
  name: order-service
spec:
  to:
    kind: Service
    name: order-service
  port:
    targetPort: 8080
  tls:
    termination: edge
Kubernetes: Internet → Load Balancer → Ingress → Service → Pod OpenShift: Internet → Load Balancer → Route → Service → Pod
DeploymentServiceIngress / Route
Defines how application Pods run.Provides stable internal access.Provides external HTTP/HTTPS routing.

8. Readiness, Liveness & Startup Probes

Golden interview line: Readiness controls traffic; liveness controls restart; startup protects slow-starting applications.

Readiness Probe

Purpose: Determines whether the Pod is ready to receive traffic.

readinessProbe:
  httpGet:
    path: /actuator/health/readiness
    port: 8080
  initialDelaySeconds: 10
  periodSeconds: 10

If readiness fails, the Pod is normally removed from Service endpoints. It is not necessarily restarted.

Liveness Probe

Purpose: Determines whether the container is alive; repeated failure causes Kubernetes to restart it.

livenessProbe:
  httpGet:
    path: /actuator/health/liveness
    port: 8080
  initialDelaySeconds: 30
  periodSeconds: 20

Startup Probe

Purpose: Gives slow-starting applications time to initialize before liveness checks become effective.

startupProbe:
  httpGet:
    path: /actuator/health/liveness
    port: 8080
  failureThreshold: 30
  periodSeconds: 10
ProbeQuestionFailure Impact
ReadinessCan this Pod receive traffic?Traffic is stopped/removed from endpoints.
LivenessIs this container still healthy enough to run?Container can be restarted.
StartupHas this slow-starting app finished starting?Protects it from premature liveness failure.

9. Helm — Kubernetes Package Manager

One-line definition: Helm packages and templates Kubernetes manifests so the same application can be deployed consistently across environments.

Typical Chart

order-service/
├── Chart.yaml
├── values.yaml
└── templates/
    ├── deployment.yaml
    ├── service.yaml
    ├── ingress.yaml
    └── route.yaml

values.yaml

replicaCount: 3

image:
  repository: order-service
  tag: "1.2.0"

service:
  port: 8080

Template

replicas: {{ .Values.replicaCount }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
Senior answer: “We keep environment-specific values outside the reusable Kubernetes templates. Helm lets us use the same chart for dev, QA and production with different values and controlled releases.”

10. Secrets, Cloud Secret Managers & Vault

Secret: Sensitive information such as database passwords, API keys, OAuth client secrets, tokens or private keys.

Kubernetes Secret

apiVersion: v1
kind: Secret
metadata:
  name: db-secret
type: Opaque
stringData:
  username: appuser
  password: mypassword

Consume Secret in a Pod

env:
  - name: DB_PASSWORD
    valueFrom:
      secretKeyRef:
        name: db-secret
        key: password
Important: A Kubernetes Secret is not automatically equivalent to an enterprise secret-management solution. Production organizations often use cloud secret managers or Vault with stronger centralized access, audit and rotation capabilities.
SolutionBest Interview Understanding
Kubernetes SecretNative Kubernetes mechanism for sensitive configuration.
AWS Secrets ManagerManaged AWS secret storage with IAM, rotation and auditing capabilities.
Azure Key VaultManaged Azure service for secrets, keys and certificates.
GCP Secret ManagerManaged GCP secret storage integrated with IAM.
HashiCorp VaultEnterprise/cross-cloud secret management with strong policy controls and dynamic secrets.
Secret Store CSI DriverAllows Kubernetes Pods to consume secrets from external secret-management systems.
External Secret Manager ↓ Secret Store / Integration ↓ Kubernetes Pod ↓ Spring Boot Application

11. Certificates & TLS

TermOne-Line Understanding
Server CertificateProves the identity of the server to the client.
Client CertificateUsed to identify/authenticate the client in mTLS.
CA CertificateEstablishes the trusted certificate authority chain.
Wildcard CertificateCan cover multiple subdomains such as *.example.com.
Private KeySecret cryptographic material associated with a certificate.

TLS Flow

Client ↓ Server Certificate ↓ Certificate / CA Validation ↓ TLS Handshake ↓ Encrypted Communication

Where TLS Can Terminate

Depending on architecture, TLS may terminate at a cloud load balancer, ingress controller, OpenShift Route, API gateway, or the Spring Boot application itself.

Secret vs Certificate: A password/token is a credential secret; a certificate represents digital identity/trust. A certificate's private key is sensitive secret material.

12. OpenShift

One-line definition: OpenShift is Red Hat's enterprise Kubernetes platform with additional security, developer tooling, routing, Operators, lifecycle management and platform integrations.

TechnologyInterview Definition
DockerPackages and runs containers.
KubernetesOrchestrates containers at scale.
OpenShiftEnterprise Kubernetes platform with additional platform capabilities.
Good interview statement: “OpenShift uses Kubernetes as its orchestration foundation, but adds an enterprise platform layer around security, routing, Operators, developer experience and lifecycle management.”

13. Other Important Kubernetes Resources

ResourceOne-Line UnderstandingTypical Use
ConfigMapStores non-sensitive configuration.URLs, feature flags, environment settings.
SecretStores sensitive configuration.Password, token, key.
NamespaceLogical grouping/isolation.dev, qa, prod.
StatefulSetManages stateful applications with stable identity/storage.Databases, clustered stateful systems.
DaemonSetRuns a Pod on each eligible Node.Logging/monitoring agents.
JobRuns a task to completion.Batch processing.
CronJobRuns Jobs on a schedule.Scheduled cleanup/reporting.
HPAAutomatically adjusts Pod replicas based on metrics.CPU/memory/custom metric scaling.
PVCRequests persistent storage.Persistent application data.
ServiceAccountIdentity used by workloads for Kubernetes/API access.Pod authentication and RBAC.

14. Complete Production Deployment Flow

Developer ↓ Git Repository ↓ CI/CD Pipeline ↓ Maven Build ↓ Spring Boot JAR ↓ Docker Build ↓ Container Image ↓ Container Registry ↓ Helm ↓ Kubernetes / OpenShift ↓ Deployment ↓ ReplicaSet ↓ Pods ↓ Startup / Readiness / Liveness ↓ Service ↓ Ingress / OpenShift Route ↓ Load Balancer ↓ Client

Production Request Flow

Internet ↓ Cloud Load Balancer ↓ Ingress / OpenShift Route ↓ Order Service ↓ Healthy Order Pod ↓ Spring Boot Controller ↓ Service Layer ↓ Repository ↓ Database

What Happens if a Pod Dies?

1. Kubernetes detects that the actual state differs from the desired state.

2. The Deployment/ReplicaSet reconciliation process creates a replacement Pod.

3. The new Pod starts the Spring Boot application.

4. Startup/readiness checks determine when it is ready.

5. The Service sends traffic only to eligible healthy endpoints.

Interview phrase: “Kubernetes continuously reconciles actual state with desired state.”

Rolling Deployment

Before: V1 V1 V1 Step 1: V1 V1 V2 Step 2: V1 V2 V2 Final: V2 V2 V2

Readiness checks help prevent traffic from being sent to a newly started Pod before the application is ready.

15. Senior Interview Questions & Answers

Q1. What is Kubernetes? Kubernetes is a container orchestration platform that automates deployment, scaling, service discovery, health management and self-healing of containerized workloads.
Q2. What is the difference between Pod, Node and Cluster? A Pod runs one or more containers, a Node runs Pods, and a Cluster is the complete Kubernetes environment containing the control plane and worker Nodes.
Q3. Deployment vs Service? Deployment manages the desired state and lifecycle of Pods; Service provides a stable network endpoint and routes traffic to matching Pods.
Q4. Readiness vs Liveness? Readiness answers “should this Pod receive traffic?” while liveness answers “should this container be restarted?”
Q5. Why do we need a Service if Pods already have IPs? Pod IPs are ephemeral; a Service provides a stable DNS/IP endpoint and selects the current healthy Pods behind it.
Q6. Ingress vs OpenShift Route? Ingress is the Kubernetes HTTP/HTTPS routing resource, while Route is an OpenShift-specific resource used to expose Services externally.
Q7. What is Helm? Helm is a Kubernetes package/template manager used to create reusable charts and deploy the same application with environment-specific values.
Q8. How do you manage secrets in production? Avoid hardcoding secrets in source code or plain configuration. Prefer a managed secret store such as AWS Secrets Manager, Azure Key Vault, GCP Secret Manager or Vault, with IAM/RBAC, encryption, auditing and rotation.
Q9. What is HPA? Horizontal Pod Autoscaler automatically changes the number of Pod replicas based on CPU, memory or custom/external metrics.
Q10. What is self-healing in Kubernetes? Kubernetes continuously reconciles desired and actual state and replaces failed Pods or reschedules workloads when possible.
Q11. Why use Docker with Kubernetes? Docker/container tooling packages the application into a portable image, while Kubernetes manages those containerized workloads across a cluster.
Q12. Why use OpenShift instead of plain Kubernetes? OpenShift provides an enterprise platform around Kubernetes with additional security controls, routing, Operators, developer tooling and lifecycle capabilities.
Q13. What are requests and limits? Requests influence scheduling and reserve expected capacity; limits cap the resources a container is allowed to consume.
Q14. How would you expose a Spring Boot microservice? Deploy the application using a Deployment, expose Pods with a Service, and use Ingress or an OpenShift Route for external HTTP/HTTPS access. Configure readiness/liveness probes and TLS as required.
Q15. Explain your production architecture in one answer. A typical flow is Git → CI/CD → Maven → JAR → Docker image → registry → Helm → Kubernetes/OpenShift Deployment → Pods → probes → Service → Ingress/Route → load balancer → client, with externalized configuration, secrets, certificates, monitoring and autoscaling.

16. 30-Second Senior Interview Answer

“In our microservices architecture, we build the Spring Boot application using Maven and package it as a Docker image. The image is pushed to a container registry and deployed to Kubernetes or OpenShift using Helm. A Deployment manages the desired number of Pods and rolling updates. Each Pod exposes the application on its container port, while a Service provides stable internal service discovery and load balancing. For external access, we use Kubernetes Ingress or an OpenShift Route, usually behind a cloud load balancer. Readiness probes control whether a Pod receives traffic, liveness probes help restart unhealthy containers, and startup probes protect slow-starting applications. Configuration is externalized using ConfigMaps and environment-specific configuration, while sensitive information is managed through Kubernetes Secrets or enterprise secret stores such as cloud Secret Manager/Key Vault/Secrets Manager or Vault. TLS certificates are used to secure external or internal communication.”

Final Memory Map

CLOUD ↓ REGISTRY ↓ DOCKER IMAGE ↓ KUBERNETES / OPENSHIFT ↓ CLUSTER ↓ NODE ↓ POD ↓ SPRING BOOT ↓ CONFIG + SECRET + CERTIFICATE ↓ READINESS / LIVENESS / STARTUP ↓ SERVICE ↓ INGRESS / ROUTE ↓ LOAD BALANCER ↓ CLIENT
Five lines to memorize:
1. Docker packages the application.
2. Kubernetes orchestrates containers.
3. Deployment manages Pods and rolling updates.
4. Service provides stable internal connectivity.
5. Readiness controls traffic; liveness controls restart.