DevOps Classroom notes 31/Dec/2025

Pods

  • Pod ensures containers are in running state, if container is exited, pod restarts the container
  • Two errors:
    • crashloop backoff
    • OOM killed
  • Application run is a container but wrapped as pod.
  • IF we want to scale application, we scale pods not containers.
  • To control pods we have resources such as
    • replicasets (ReplicationController)
    • Daemonsets
    • Deployments

Labels

  • Labels are key value pairs
  • Labels are used as query mechanism in k8s

Playing with labels

  • Watch classroom recording

  • Labels can be queried using selectors
  • selectors are of two types
  • Writing labels in manifest. Labels are part of metadata

Replica sets

  • Replica set ensure the number of pods is maintained
  • In Replica set we specify
    • pod
    • number of pods
  • Replica sets identify pods with labels with both equality and set based selectors

Example 1: Lets create a replicaset with 4 nginx pods

  • Spec
---
apiVersion: apps/v1
kind: ReplicaSet
metadata:
  name: example-1
  labels:
    purpose: learning
spec:
  replicas: 4
  minReadySeconds: 2
  selector:
    matchLabels:
      app: web
  template:
    metadata:
      labels:
        app: web
        env: dev
    spec:
      containers:
        - name: nginx
          image: nginx:1.14.2
          resources:
            limits:
              memory: "128Mi"
              cpu: "500m"
          ports:
            - containerPort: 80

  • replicasets creates pods mentioned in the template section if the desired count vs actual count is not same.
  • Replica sets calcualtes desired count on the basis of matching labels
  • Exercise:
    • Try finding a command to run the repliaset with 2 httpd pods

Exercise – docker

  • write a multistaged docker file using distroless java for spring petclinic with minimal size possible and no major vulnerabilities.
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a comment

Turn on JavaScript to leave a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design Company
Exit mobile version
%%footer%%