DevOps Classroom notes 16/Jul/2025

Jobs, CronJobs

  • Jobs
  • Cronjobs creates jobs on schedule
  • Lets write a cronjob which runs every 5 minutes
    Preview
    Preview

Scheduling Pods on Nodes

  • By default k8s chooses a node and if we need to influence that we can schedule Refer Here
  • Scheduling is done by one of approaches
    • pods/workloads trying to choose a node
      • node selector
      • affinity based selections
    • node trying to put a criteria for a pod to run on the node
      • taints & tolerations
  • K8s also allow to create your own schedulers.

Pod Selecting a node by label or name

  • Example of directly selecting a node
---
apiVersion: v1
kind: Pod
metadata:
  name: selectnode-1
spec:
  nodeName: aks-nodepool1-33085162-vmss000002
  containers:
    - name: web
      image: nginx
      resources:
        requests:
          cpu: 100m
          memory: 10M
        limits:
          cpu: 500m
          memory: 128M
  • Node selector
---
apiVersion: v1
kind: Pod
metadata:
  name: selectnode-1
spec:
  nodeSelector:
    env: dev
  containers:
    - name: web
      image: nginx
      resources:
        requests:
          cpu: 100m
          memory: 10M
        limits:
          cpu: 500m
          memory: 128M

Affinity based selection

  • Refer Here for affinity
  • Affinity has 3 options
    • nodeAffinity
    • podAffinity
    • podAntiAffinity
  • In affinity based selections you will have
    • requiredDuringSchedulingIgnoredDuringExecution: This is hard rule pod will be schedule only when this condition is met
    • preferredDuringSchedulingIgnoredDuringExecution: This is soft rule pod will be schedule preferrable on the condition, but if the condition is not met k8s will schedule the pod on best fit node.

To be continued.

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