Skip to content

This plugin is my first project in my k8s life. Just a toy :)

Notifications You must be signed in to change notification settings

kanata2/kubectl-jobnotify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kubectl-jobnotify

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 :)

Setup

$ 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.

Usage

$ kubectl jobnotify --job <your_job_name> -d <destination(stdout or slack)>

More info: kubectl jobnotify help

Example

  1. 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
  1. $ kubectl jobnotify --job sleeper --destination slack

  2. notify to you

result

About

This plugin is my first project in my k8s life. Just a toy :)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published