This plugin make you notify k8s's job completion through some tools (currently only STDOUT, Slack).
However this is just a toy(i.e. not production-ready) for studying Kubernetes :)
$ go get git@github.com:kanata2/kubectl-jobnotify
$ make build
$ mv kubectl-jobnotify /path/to/bin
$ export SLACK_WEBHOOK_URL=https://hooks.slack.com/services/xxxxxxx/xxxxxxx/xxxxxxx # need if you want to notify to Slack.
$ kubectl jobnotify --job <your_job_name> -d <destination(stdout or slack)>
More info: kubectl jobnotify help
- make job yaml and apply
$ cat <<YAML > job.yaml
apiVersion: batch/v1
kind: Job
metadata:
name: sleeper
spec:
completions: 5
parallelism: 3
template:
spec:
containers:
- name: sleep
image: alpine
command: ["sh", "-c"]
args:
- |
sleep 3
restartPolicy: Never
YAML
$ kubectl apply -f job.yaml
job.batch/sleeper created
-
$ kubectl jobnotify --job sleeper --destination slack
-
notify to you