Job
The Job object is responsible for creating and managing Pods in a template in Job specification. These pods run until successful completion.
* If the Pod fails before successful termination, the job controller will create a new Pod based on the Pod template in the job spec.
* Jobs are designed to manage batch-like worloads, where the items are processed by one or more pods
* Job patterns
| Type | Usecase | Behavior | completions | Parallelism |
|---|---|---|---|---|
| One Shot | Database Migrations | A single running once until succesful termination | 1 | 1 |
| Paralled fixed completions | Multiple pods processing a set of work in parallel | One or more pods running till completion | 1+ | 1+ |
| Work queue | Multiple pods processing from centralized work queue | One or more pods running till completion | 1 | 2+ |
- One-shot: Refer Here for the changes. Refer Here for the changes done to make things work
- Now try to create a success job

- Now try to create a job which fails

- Now describe the failed job and see the warning

- Parallelism: Refer Here for the changes
- Now create the jon
NAME READY STATUS RESTARTS AGE
parallel--1-b2mnl 1/1 Running 0 6s
parallel--1-kllsh 1/1 Running 0 6s
parallel--1-psvmz 1/1 Running 0 6s
parallel--1-r4ftm 1/1 Running 0 6s
parallel--1-zprr9 1/1 Running 0 6s
parallel--1-zprr9 0/1 Completed 0 12s
parallel--1-r4ftm 0/1 Completed 0 12s
parallel--1-9wcdl 0/1 Pending 0 0s
parallel--1-9wcdl 0/1 Pending 0 0s
parallel--1-wdxzd 0/1 Pending 0 0s
parallel--1-wdxzd 0/1 Pending 0 0s
parallel--1-9wcdl 0/1 ContainerCreating 0 0s
parallel--1-wdxzd 0/1 ContainerCreating 0 0s
parallel--1-psvmz 0/1 Completed 0 13s
parallel--1-fs45m 0/1 Pending 0 0s
parallel--1-fs45m 0/1 Pending 0 0s
parallel--1-fs45m 0/1 ContainerCreating 0 0s
parallel--1-9wcdl 1/1 Running 0 2s
parallel--1-wdxzd 1/1 Running 0 2s
parallel--1-kllsh 0/1 Completed 0 14s
parallel--1-p98w5 0/1 Pending 0 0s
parallel--1-fs45m 1/1 Running 0 1s
parallel--1-p98w5 0/1 Pending 0 0s
parallel--1-p98w5 0/1 ContainerCreating 0 0s
parallel--1-b2mnl 0/1 Completed 0 14s
parallel--1-m7lrb 0/1 Pending 0 0s
parallel--1-m7lrb 0/1 Pending 0 0s
parallel--1-m7lrb 0/1 ContainerCreating 0 0s
parallel--1-m7lrb 1/1 Running 0 1s
parallel--1-p98w5 1/1 Running 0 2s
parallel--1-9wcdl 0/1 Completed 0 12s
parallel--1-wdxzd 0/1 Completed 0 12s
parallel--1-fs45m 0/1 Completed 0 11s
parallel--1-p98w5 0/1 Completed 0 12s
parallel--1-m7lrb 0/1 Completed 0 12s

CronJob
- Sometimes we need to schedule the jobs to run in certain interval, To achieve this we have cron jobs
- Exercise: Write a k8s manifest for cron job which runs every 5 minutes. In the pod sleep for 10s
- Refer Here for the changes
- run the cronjob

Accessing the Applications running in replica sets
- k8s has a service object which acts like a load balancer and this service can be exposed to the outside world using loadbalancers/port forwarding/DNS alias etc..
- k8s service can forward the requests it recieves to the pods which match the labels
- Each service recieves an IP address private to the cluster called as Cluster ip
- Refer Here for the changes done


Azure Kuberenetes Service (AKS)
- This is managed kubernetes from Azure Cloud
- There are two node types
- control plane node/masters
- node
- AKS manages control plane node and it does it for free. We only pay for the nodes
- Creating AKS Cluster can be done from CLI/Powershell/Portal
- In this session we would be using CLI Refer Here
