DevOps Classroom notes 07/Oct/2026

Resources: request and limit

Refer Here resource manage

Resource type Description Base unit
cpu Compute processing cpu (core)
memory RAM Bytes
ephemeral-storage Local ephemeral storage Bytes
hugepages-<size> Huge pages (Linux only) Bytes

### Add resource limits and requests in pod

resources: request: cpu: “500m” memory:“128mi” limits: cpu: “1” memory:“2”

apiVersion: v1
kind: Pod
metadata:
  name: sample-pod
  labels:
    app: sample
    environment: production
spec:
  containers:
    - name: sample-container
      image: nginx:latest
      ports:
        - containerPort: 80
      resources:
        request:
            cpu: "500m"
            memory:"128mi"
        limits:
            cpu: "1"
            memory:"2"
    - name: init-sample
      image: busybox:latest
      command: ["sh", "-c", "echo Initializing... && sleep 10"]
/bin/bash -c

QOS

Offical docs QOS

Guaranteed:

  • every container will have limits == request
  • give request and limit we be having limits values
resources:
  request:
    cpu: "2"
    memory:"4"
  limits:
    cpu: "2"
    memory:"4"

Burstable:

  • it required resources request and limit need to mention
  • every container will have limits > request
resources:
  request:
    cpu: "500m"
    memory:"1"
  limits:
    cpu: "2"
    memory:"4"

Best-Effort

  • no resource request and limits required
  • it will automatically managed by K8s

workloads in k8s

Offical docs

  1. pod : single unit which will run the application as container
  2. replica-controller: it will create no of pods based replicas count
  3. replicaset: keep N identical pods running (disered state)
  4. Deployment: stateless apps (runing continously and deploy, upgrade and rollback will be suppourted) (webapps,)
  5. statefullset: run apps in statefull (databases, kafka)
    1. stable name and storage
  6. DaemonSet: run one pod per node (logs and monitoring)
  7. job : run to complte (used for run some automation scrpits and migrations)
  8. cronjob: scheduled jobs ( backups, cleanup, generate reports) sample cron expersion

kubectl cmds for pod:

#### Basic cmds

kubectl get pods # get all pods in default namespace
kubectl get pods -n <namespace>
kubectl get pods -n kube-system # namespace is kube-system
kubectl get pods -A  # To get all pods from all namespaces
kubectl get pods nopcommerceteam  # see details specific pod
kubectl get pods -w # watch pods
kubectl get pods -o wide # details of pods
kubectl apply -f filename.yaml # create pod by yaml file
kubectl run --name=nginx --image=nignx:latest 

#### debug:
kubectl logs <podname> -n <namespace> # when container is created
kubectl describe <podname> -n <namespace> # give details for pods
kubectl logs -f <podname> -n <namespace>
kubectl logs <podname> -c <conatinername> -n <namespace> # Get logs for specific container.

## Delete cmds:
kubectl delete -f  filename.yaml # to delete pod by using yaml file
kuebctl delete pod <podname> -n <namespace> # delete pod by pod name 
---
apiVersion: v1
kind: Pod
metadata:
  name: nopcommerceteam
  labels:
    app: nopcommerce
    environment: production
spec:
  containers:
    - name: nopcommerce-container1
      image: httpd:latest
      ports:
        - containerPort: 5000
      resources:
        limits:
          memory: "512Mi"
          cpu: "500m"
        requests:
          memory: "256Mi"
          cpu: "250m"

---
apiVersion: v1
kind: Pod
metadata:
  name: apache2
  labels:
    app: apache2
    environment: production
spec:
  containers:
    - name: apache2
      image: httpd:latest
      ports:
        - containerPort: 80
      resources:
        limits:
          memory: "512Mi"
          cpu: "500m"
        requests:
          memory: "256Mi"
          cpu: "250m"

Task:

  1. create different pod and try above QOS (resources)
  2. try all above k8s commnads

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
Customized Social Media Icons from Acurax Digital Marketing Agency
Exit mobile version
%%footer%%