DevOps Classroom notes 10/Jul/2025

Types of containers in a Pod

  • In Pod we have three types of containers
    • containers: This is where we run our applications and ideally they would be running all the time. Containers in this will all start in parallel
    • init containers: These are containers which will be created before the containers only after they finish execution the main containers. They execute in sequence. init containers are supposed to check for pre-reqs Refer Here for official docs
  • Consider the following spec
---
apiVersion: v1
kind: Pod
metadata:
  name: eight
spec:
  containers:
    - name: web
      image: nginx
      resources:
        requests:
          cpu: 100m
          memory: 10M
        limits:
          cpu: 500m
          memory: 128M
  initContainers:
    - name: cont1
      image: alpine
      args:
        - sleep
        - 5s
    - name: cont2
      image: alpine
      args:
        - sleep
        - 10s
  • Now lets create and watch for pod
    Preview
  • Refer Here for ephemeral containers

Pod lifecycle

Controllers

  • Pod desired state is to ensure container is running
  • Controllers manage Pods Refer Here

ReplicaSet

  • Refer Here for official docs.
  • Replicaset can maintain replicas of Pods.

Example 1: Create a repicaset with 3 nginx containers

---
apiVersion: apps/v1
kind: ReplicaSet
metadata:
  name: nginx
  labels:
    app: nginx
    me: controller
    type: rs
spec:
  minReadySeconds: 5
  replicas: 3
  selector:
    matchLabels:
      app: web
      env: dev
  template:
    metadata:
      labels:
        app: web
        env: dev
        srv: nginx
    spec:
      containers:
        - name: web
          image: nginx

Preview

  • Now to increase number of replicas we can use kubectl scale, but it is recommended to change yaml and reexecute kubectl apply -f <filepath>

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

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

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube