DevOps Classroom notes 03/Feb/2024

Jobs and Cronjobs in kubernetes

  • In enterprise grade application we have batch jobs and scheduled jobs
  • For doing the above mentioned activites we have
    • Job
    • CronJob
  • Here Job expects the Pod to get into Completed state and Cron Job schedule the Pod to execute on some schedule
  • Refer Here for official docs
  • Lets run a cron job which runs every weekday at 1:00 AM which executes a container (sleep 300s)
  • Refer Here for cron schedules
  • Refer Here for specs

Daemonsets

  • Refer Here for daemonset
  • Daemonsets support rolling updates
  • Lets create a daemon set which runs on every node Refer Here for changes.
  • Note: Metrics Server Refer Here is an add-on in k8s which is enabled in managed k8s where as in kube-adm that is additional installation
kubectl top node
kubectl top pod

Scheduling pods in k8s

  • Assigning pods to a node Refer Here
    • nodeSelector
    • Affinity and Anti-Affinity
    • nodeName
    • taints and tolerations
    • Resource Limits based (random)
  • NodeSelector
---
apiVersion: v1
kind: Pod
metadata:
  name: web
  labels:
    name: web
    env: dev
spec:
  nodeSelector:
    test: prod
  containers:
  - name: web
    image: nginx
    resources:
      limits:
        memory: "128Mi"
        cpu: "500m"
    ports:
      - containerPort: 80

  • nodeName
---
apiVersion: v1
kind: Pod
metadata:
  name: nodenamedemo
  labels:
    name: web
    env: dev
spec:
  nodeName: "aks-nodepool1-22765696-vmss000000"
  containers:
  - name: web
    image: nginx
    resources:
      limits:
        memory: "128Mi"
        cpu: "500m"
    ports:
      - containerPort: 80
  • To be discussed tomorrwo
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a ReplyCancel reply

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

Please turn AdBlock off
Plugin for Social Media by Acurax Wordpress Design Studio

Discover more from Direct DevOps from Quality Thought

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

Continue reading

Exit mobile version
%%footer%%