Menu

DevOps & Cloud Topic

Advanced DevOps Concepts

1. What is GitOps and how does it differ from traditional DevOps?

Answer: GitOps is an operational framework that uses Git as a single source of truth for both infrastructure and application deployment.

Key Principles:

  • Declarative: System state described declaratively

  • Versioned & Immutable: Git stores desired state

  • Automated: Automated pull-based deployments

  • Continuous Reconciliation: System continuously reconciles with Git state

Traditional DevOps vs GitOps:

  • DevOps: Push-based, imperative, multiple tools

  • GitOps: Pull-based, declarative, Git-centric

Tools: ArgoCD, FluxCD

2. Explain Canary Deployment strategy.

Answer: Gradual rollout where new version is deployed to a small subset of users before full deployment.

Process:

  1. Deploy new version to small percentage of traffic (e.g., 5%)

  2. Monitor metrics (error rates, performance)

  3. Gradually increase traffic if no issues

  4. Roll back if problems detected

Benefits: Risk mitigation, real-user testing, performance validation

3. What is Service Mesh and why is it used?

Answer: Service mesh is a dedicated infrastructure layer for handling service-to-service communication in microservices.

Key Features:

  • Traffic Management: Load balancing, circuit breaking

  • Security: mTLS, authentication, authorization

  • Observability: Metrics, tracing, logging

  • Resilience: Retries, timeouts, fault injection

Tools: Istio, Linkerd, Consul

4. What are the differences between Monolithic and Microservices architecture?

Answer:

Aspect Monolithic Microservices
Development Single codebase Multiple codebases
Deployment Single deployment Independent deployments
Scaling Scale entire app Scale individual services
Technology Homogeneous Heterogeneous
Database Shared database Database per service
Complexity Simple initially Complex coordination

Cloud-Specific Questions

5. Explain AWS EC2 Auto Scaling components.

Answer:

  • Launch Configuration/Template: Defines instance specifications (AMI, instance type, security groups)

  • Auto Scaling Group (ASG): Logical grouping of EC2 instances for scaling

  • Scaling Policies: Rules for scaling (CPU utilization, network traffic)

  • Health Checks: Determines instance health status

Types of Scaling:

  • Target Tracking: Maintain specific metric value

  • Step Scaling: Scale based on breach of thresholds

  • Scheduled Scaling: Predictable load patterns

6. What is AWS S3 and what are its storage classes?

Answer: Amazon S3 (Simple Storage Service) is object storage service.

Storage Classes:

  • S3 Standard: Frequently accessed data

  • S3 Intelligent-Tiering: Unknown or changing access patterns

  • S3 Standard-IA: Infrequently accessed data

  • S3 One Zone-IA: Secondary backup

  • S3 Glacier: Archive data (minutes retrieval)

  • S3 Glacier Deep Archive: Lowest cost (hours retrieval)

7. What is AWS VPC and its components?

Answer: Virtual Private Cloud - isolated network in AWS cloud.

Key Components:

  • Subnets: Segment of VPC IP address range

  • Route Tables: Define traffic routing rules

  • Internet Gateway: Connect VPC to internet

  • NAT Gateway: Outbound internet for private subnets

  • Security Groups: Stateful firewall at instance level

  • Network ACLs: Stateless firewall at subnet level

8. Explain Kubernetes architecture and main components.

Answer:
Control Plane (Master Nodes):

  • API Server: Frontend for Kubernetes control plane

  • etcd: Consistent and highly-available key value store

  • Scheduler: Assigns pods to nodes

  • Controller Manager: Runs controller processes

Worker Nodes:

  • Kubelet: Agent that runs on each node

  • Kube Proxy: Network proxy and load balancer

  • Container Runtime: Docker, containerd

Pods: Smallest deployable units containing one or more containers


Infrastructure & Configuration Management

9. What is Terraform and how does it differ from Ansible?

Answer:

  • Terraform: Infrastructure as Code tool focused on provisioning and lifecycle management (declarative)

  • Ansible: Configuration management tool focused on application deployment and configuration (procedural)

Comparison:

Aspect Terraform Ansible
Purpose Infrastructure provisioning Configuration management
Approach Declarative Procedural/Declarative
State Management Maintains state file Stateless
Cloud Support Excellent Good
Agentless Yes Yes

10. Explain Terraform workflow.

Answer:

  1. Write: Define resources in .tf files

  2. Initialize: terraform init - downloads providers

  3. Plan: terraform plan - shows execution plan

  4. Apply: terraform apply - creates resources

  5. Destroy: terraform destroy - removes resources

Example:

hcl

# main.tf
resource "aws_instance" "web" {
  ami           = "ami-0c02fb55956c7d316"
  instance_type = "t3.micro"
  tags = {
    Name = "HelloWorld"
  }
}

11. What are Terraform modules and why use them?

Answer: Modules are containers for multiple resources that are used together.

Benefits:

  • Reusability: Use same configuration across environments

  • Abstraction: Hide complexity behind simple interfaces

  • Maintainability: Centralized updates

  • Consistency: Standardized configurations

Example:

hcl

module "vpc" {
  source = "terraform-aws-modules/vpc/aws"
  
  name = "my-vpc"
  cidr = "10.0.0.0/16"
  
  azs             = ["us-west-2a", "us-west-2b"]
  private_subnets = ["10.0.1.0/24", "10.0.2.0/24"]
  public_subnets  = ["10.0.101.0/24", "10.0.102.0/24"]
}

12. What is Packer and what problem does it solve?

Answer: Packer is a tool for creating machine images (AMIs, Docker images) from source configuration.

Benefits:

  • Immutable Infrastructure: Consistent, versioned images

  • Fast Deployment: Pre-baked images deploy quickly

  • Multi-Platform: Create images for multiple platforms from single source

  • Security: Images can be pre-hardened and scanned

Example:

json

{
  "builders": [{
    "type": "amazon-ebs",
    "region": "us-west-2",
    "source_ami": "ami-0c02fb55956c7d316",
    "instance_type": "t3.micro",
    "ssh_username": "ubuntu",
    "ami_name": "my-app-{{timestamp}}"
  }],
  "provisioners": [{
    "type": "shell",
    "script": "setup.sh"
  }]
}

Containerization & Orchestration

13. What are Kubernetes Namespaces and why use them?

Answer: Namespaces provide virtual clusters within a physical Kubernetes cluster.

Use Cases:

  • Environment Separation: dev, staging, prod

  • Team Isolation: Different teams in same cluster

  • Resource Quotas: Limit resources per namespace

  • Access Control: RBAC per namespace

Example:

yaml

apiVersion: v1
kind: Namespace
metadata:
  name: production

14. Explain Kubernetes Deployments vs StatefulSets.

Answer:

  • Deployments: For stateless applications, random pod names, shared storage

  • StatefulSets: For stateful applications, ordered pod names, persistent storage

StatefulSet Characteristics:

  • Stable, unique network identifiers

  • Stable, persistent storage

  • Ordered, graceful deployment and scaling

  • Ordered, automated rolling updates

15. What are Kubernetes ConfigMaps and Secrets?

Answer:

  • ConfigMaps: Store non-confidential configuration data (environment variables, config files)

  • Secrets: Store sensitive information (passwords, OAuth tokens, SSH keys)

Example ConfigMap:

yaml

apiVersion: v1
kind: ConfigMap
metadata:
  name: app-config
data:
  database_url: "postgresql://localhost:5432"
  log_level: "INFO"

Example Secret (base64 encoded):

yaml

apiVersion: v1
kind: Secret
metadata:
  name: db-secret
type: Opaque
data:
  username: YWRtaW4=
  password: cGFzc3dvcmQ=

16. What is Docker Compose and when is it used?

Answer: Tool for defining and running multi-container Docker applications.

Use Cases:

  • Local development environments

  • Testing multi-service applications

  • Simple deployments

Example:

yaml

version: '3.8'
services:
  web:
    build: .
    ports:
      - "8000:8000"
    depends_on:
      - db
  db:
    image: postgres:13
    environment:
      POSTGRES_PASSWORD: example

Monitoring & Logging

17. What is the ELK Stack and how does it work?

Answer: Elasticsearch, Logstash, Kibana - for log aggregation and analysis.

Components:

  • Elasticsearch: Search and analytics engine

  • Logstash: Server-side data processing pipeline

  • Kibana: Visualization and dashboard tool

Alternative: EFK Stack (Elasticsearch, Fluentd, Kibana)

18. What is Prometheus and how does it monitor applications?

Answer: Prometheus is an open-source monitoring and alerting toolkit.

Key Features:

  • Multi-dimensional Data Model: Key-value pairs for time series data

  • Pull-based Model: Scrapes metrics from targets

  • Powerful Query Language: PromQL

  • Alerting: Flexible alerting rules

Architecture:

  • Prometheus Server (scrapes and stores metrics)

  • Client Libraries (instrument application code)

  • Push Gateway (for short-lived jobs)

  • Alertmanager (handles alerts)

19. Explain the difference between metrics, logs, and traces.

Answer:

  • Metrics: Numerical measurements over time (CPU usage, request rate)

  • Logs: Timestamped events with structured/unstructured data

  • Traces: Follow request path through distributed systems

Together they form the "Three Pillars of Observability"


Security & Best Practices

20. What is the Principle of Least Privilege in cloud security?

Answer: Users and systems should have only the minimum permissions necessary to perform their tasks.

Implementation:

  • AWS: IAM roles with specific policies

  • Kubernetes: RBAC with minimal permissions

  • Containers: Run as non-root users

  • Networks: Minimal open ports

21. How do you manage secrets in Kubernetes?

Answer:

  1. Kubernetes Secrets: Built-in secret management (base64 encoded)

  2. External Secret Operators: External Secrets, Sealed Secrets

  3. Cloud Provider Solutions: AWS Secrets Manager, Azure Key Vault

  4. HashiCorp Vault: Comprehensive secret management

Best Practices:

  • Encrypt secrets at rest

  • Use RBAC to restrict access

  • Rotate secrets regularly

  • Avoid storing in version control

22. What is Immutable Infrastructure and its benefits?

Answer: Infrastructure components are replaced rather than modified.

Benefits:

  • Consistency: No configuration drift

  • Reliability: Known good state

  • Rollbacks: Easy version rollbacks

  • Security: Fresh instances reduce attack surface

Implementation:

  • Replace AMIs/containers instead of updating

  • Use infrastructure as code

  • Automated deployment pipelines


Scenario-Based Questions

23. How would you design a highly available web application on AWS?

Answer:
Architecture:

  • Load Balancer: Application Load Balancer across multiple AZs

  • Compute: Auto Scaling Group with EC2 instances or ECS/EKS

  • Database: Multi-AZ RDS with read replicas

  • Storage: S3 for static assets with CloudFront CDN

  • Caching: ElastiCache Redis/Memcached

  • DNS: Route 53 with health checks

  • Monitoring: CloudWatch alarms and logs

24. How do you handle database migrations in CI/CD?

Answer:

  1. Versioned Migrations: Each change as separate migration file

  2. Automated Testing: Test migrations in staging

  3. Backup Strategy: Pre-migration backups

  4. Rollback Plan: Reversible migrations or rollback scripts

  5. Zero-Downtime: Blue-green deployments, feature flags

Tools: Flyway, Liquibase, Django Migrations

These additional questions dive deeper into specific tools, architectures, and practical implementation details that are crucial for DevOps roles. They demonstrate a more comprehensive understanding of cloud-native principles and modern infrastructure practices.

 

Comments (1)

Anonymous November 16, 2025

Great

AlphaAI Assistant

Hello! I'm AlphaAI

What would you like to learn today?