-
Notifications
You must be signed in to change notification settings - Fork 4
/
24-jobs.sh
56 lines (44 loc) · 1.3 KB
/
24-jobs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
####################
# _ _
# (_) ___ | |__
# | |/ _ \| '_ \
# | | (_) | |_) |
# _/ |\___/|_.__/
# |__/
####################
kubectl apply -f others/echo-job.yaml
kubectl get job
kubectl get pod
job_app_pod1=$(kubectl get pod -o name | tail -n 1)
echo $job_app_pod1
kubectl logs $job_app_pod1
#########################################
# _ _
# ___ _ __ ___ _ __ (_) ___ | |__
# / __| '__/ _ \| '_ \ | |/ _ \| '_ \
# | (__| | | (_) | | | || | (_) | |_) |
# \___|_| \___/|_| |_|/ |\___/|_.__/
# |__/
#########################################
kubectl apply -f others/echoer-cronjob.yaml
kubectl get cronjob
kubectl get pod
cronjob_app_pod1=$(kubectl get pod -o name | tail -n 1)
echo $cronjob_app_pod1
kubectl logs $cronjob_app_pod1
kubectl delete -f others/echoer-cronjob.yaml
# QUESTION:
# ---------
# What is the difference between a cronjob and a job?
#
# https://kubernetes.io/docs/concepts/workloads/controllers/job/
# https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/
#
# QUESTION:
# ---------
# Why do you see job pods in the output of "kubectl get pod"?
# How long do they stay there?
#
# Hint: Study properties of the job
kubectl describe job echo-job
kubectl describe cronjob echoer-cronjob