πŸš€ Week 7: Kubernetes Basics & Advanced Challenge

This week was all about Kubernetes – the backbone of modern container orchestration. If Docker helps us package applications, Kubernetes ensures those containers run at scale, reliably, and securely. Through the SpringBoot BankApp project, I explored real-world Kubernetes scenarios that DevOps engineers face daily: deployments, networking, storage, scaling, RBAC, job scheduling, and even advanced tools like Helm and Service Mesh.


πŸ”Ή Task 1: Kubernetes Architecture & Deploying a Pod

πŸ— Understanding Kubernetes Architecture

Kubernetes follows a master-worker model:

  • Control Plane (Master)

    • API Server β†’ Acts as the "front door" of the cluster. All commands (kubectl) go here.

    • etcd β†’ The "database" of Kubernetes, stores the desired cluster state.

    • Scheduler β†’ Assigns pods to nodes based on resource availability.

    • Controller Manager β†’ Ensures actual state = desired state (e.g., ReplicaSet ensures required pods are running).

    • Cloud Controller β†’ Integrates with cloud providers (AWS, GCP, Azure).

  • Worker Nodes

    • Kubelet β†’ Talks to API Server, ensures containers are running.

    • Kube Proxy β†’ Handles service networking inside the cluster.

    • Container Runtime β†’ Docker/Containerd runs the actual containers.

πŸ“¦ Deploying a Pod

I created my first Pod running NGINX:

apiVersion: v1
kind: Pod
metadata:
  name: nginx-pod
  labels:
    app: nginx
spec:
  containers:
  - name: nginx
    image: nginx:latest
    ports:
    - containerPort: 80

Applied with:

kubectl apply -f pod.yaml

βœ… Learned that Pods are the smallest deployable unit in Kubernetes.


πŸ”Ή Task 2: Deployments, StatefulSets, DaemonSets & Namespaces

Kubernetes has different controllers to manage Pods efficiently.

  • Namespace β†’ Used for isolating resources.
apiVersion: v1
kind: Namespace
metadata:
  name: bankapp-namespace
  • Deployment β†’ Manages stateless pods. If a pod fails, Deployment ensures a new one comes up.
apiVersion: apps/v1
kind: Deployment
metadata:
  name: bankapp-deployment
  namespace: bankapp-namespace
spec:
  replicas: 3
  selector:
    matchLabels:
      app: bankapp
  template:
    metadata:
      labels:
        app: bankapp
    spec:
      containers:
      - name: bankapp
        image: bankapp:latest
        ports:
        - containerPort: 8080
  • StatefulSet β†’ Best for databases (stable network IDs + persistent storage).

  • DaemonSet β†’ Runs one pod per node (useful for logging/monitoring agents).

πŸ“Œ Key takeaway:

  • Deployment = stateless apps

  • StatefulSet = databases, queues

  • DaemonSet = monitoring/security


πŸ”Ή Task 3: Networking & Exposure

By default, pods are ephemeral and isolated. To expose them:

  • ClusterIP β†’ Default service, internal-only.

  • NodePort β†’ Exposes service on each node’s IP with a static port.

  • LoadBalancer β†’ Cloud provider provisioned LB for external traffic.

Example Service YAML:

apiVersion: v1
kind: Service
metadata:
  name: bankapp-service
  namespace: bankapp-namespace
spec:
  selector:
    app: bankapp
  ports:
    - port: 80
      targetPort: 8080
  type: NodePort
  • Ingress β†’ Provides HTTP routing + SSL termination.

  • Network Policies β†’ Control who can talk to whom in the cluster.

πŸ‘‰ This is where real production apps get secured.


πŸ”Ή Task 4: Storage Management

Apps like databases need persistent storage:

  • Persistent Volume (PV) β†’ Storage provided by admin.

  • Persistent Volume Claim (PVC) β†’ App requests for storage.

  • StorageClass β†’ Enables dynamic provisioning (e.g., AWS EBS, GCP PD).

Example PVC YAML:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: db-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi

βœ… Learned how Kubernetes abstracts storage like it does with compute & networking.


πŸ”Ή Task 5: ConfigMaps & Secrets

  • ConfigMap β†’ For environment configs.

  • Secret β†’ For sensitive data (base64 encoded).

Example:

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

πŸ‘‰ Mounted these into pods β†’ application consumes configs without hardcoding.


πŸ”Ή Task 6: Autoscaling & Resource Management

Defined resource requests & limits to ensure fair scheduling:

resources:
  requests:
    cpu: "100m"
    memory: "200Mi"
  limits:
    cpu: "500m"
    memory: "512Mi"
  • Implemented Horizontal Pod Autoscaler (HPA):
kubectl autoscale deployment bankapp-deployment --cpu-percent=50 --min=1 --max=5
  • Explored Vertical Pod Autoscaler (VPA) for memory-hungry apps.

πŸ“Œ Lesson: HPA = scale out, VPA = scale up.


πŸ”Ή Task 7: Security & Access Control

βœ… RBAC (Role-Based Access Control)

Created Roles & RoleBindings for different teams:

  • Admin β†’ full access

  • Developer β†’ create pods, but not delete critical resources

  • Tester β†’ read-only

πŸ‘‰ Simulated unauthorized access β†’ RBAC blocked it.

βœ… Node Taints & Pod Tolerations

  • Marked a node as critical workloads only.

  • Only pods with tolerations could run there.

βœ… Pod Disruption Budget (PDB)

Ensured at least 2 pods were always running during upgrades.


πŸ”Ή Task 8: Jobs, CronJobs & CRDs

  • Job β†’ Ran a one-time DB migration.

  • CronJob β†’ Scheduled daily backups.

  • CRD (Custom Resource Definition) β†’ Extended Kubernetes with a new resource type.

πŸ“Œ CRDs make Kubernetes infinitely extensible.


πŸ”Ή Task 9: Bonus – Helm

Created a Helm chart for SpringBoot BankApp β†’ deployed with:

helm install bankapp ./bankapp-chart

πŸ‘‰ Helm = Kubernetes package manager β†’ simplifies deployments & upgrades.


πŸ’‘ Interview Prep Q&A

  • Q: What’s the role of etcd?
    A: Stores the entire cluster state (like a database).

  • Q: Deployment vs StatefulSet vs DaemonSet?
    A: Deployment = stateless apps, StatefulSet = databases, DaemonSet = per-node agents.

  • Q: HPA vs VPA?
    A: HPA scales pods horizontally, VPA adjusts pod resources vertically.

  • Q: Why RBAC?
    A: Prevents unauthorized access β†’ critical in multi-team environments.


🌟 Key Takeaways

βœ… Kubernetes abstracts infra β†’ compute, networking, storage, configs.
βœ… Learned how to deploy, expose, scale, and secure apps.
βœ… Explored advanced tools like Helm & CRDs.
βœ… Gained interview-level knowledge of Kubernetes.


πŸ“ Final Thoughts

This week was intense! Kubernetes initially feels complex, but breaking it down into architecture β†’ workloads β†’ networking β†’ storage β†’ scaling β†’ security made it manageable.

The SpringBoot BankApp project gave me hands-on exposure that matches real-world DevOps challenges.

Excited to keep building and move towards GitOps + Cloud-native setups in future weeks πŸš€


πŸ“€ Connect With Me

πŸ”—LinkedIn: linkedin.com/in/vaishnavi-tandekar πŸ“– Blog Series: hashnode.com/@VaishnaviTandekar
πŸ’» GitHub Repo: 90DaysOfDevOps


πŸ”– Hashtags

#90DaysOfDevOps #Kubernetes #DevOps #CloudNative #InterviewPrep #Helm #Microservices


0
Subscribe to my newsletter

Read articles from Vaishnavi Tandekar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Vaishnavi Tandekar
Vaishnavi Tandekar

Hey there! I’m Vaishnavi πŸ‘‹ Learning DevOps step by step πŸ› οΈ Writing what I learn so no one learns alone ✨