Rancher 2 job monitor
With Kubernetes cron jobs it's possible to execute (batch) jobs periodically. With a monitor dashboard it's easy to see which jobs are running and if their latest status was "succeeded" or "failed".
The frontend is derived from the awesome Jenkins Build Monitor Plugin. The application uses kubectl inside the container to retrieve the data from Kubernetes.
Originally developed by @pietervogelaar for pointing to the original Kubernetes dashboard. Repo: https://github.com/pietervogelaar/kubernetes-job-monitor
Inside the cluster with a service account token (recommended)
This option is the easiest and the recommended way of installing. The Kubernetes job monitor shows all the jobs of the cluster it is deployed to. Permissions are granted by a service account and cluster role.
kubectl create namespace global
kubectl apply -f https://raw.githubusercontent.com/iwilltry42/rancher2-job-monitor/master/.kubernetes/job-monitor.yaml
The Kubernetes job monitor is deployed to the namespace "global", but can be anything.
Note: You should review the manifest above, to configure the correct host and Rancher URL for deep linking.
Inside a separate cluster with kubeconfig for remote monitoring
This option uses a kubeconfig file instead of a service account for permissions. A kubeconfig file can also describe another cluster than that the Kubernetes job monitor is deployed to. So remote monitoring is possible.
The user configured in the kubeconfig file must be able to get and list batch jobs.
Convert your kubeconfig file to one base64 encoded line:
cat /your/.kube/config | base64 | tr -d '\n'
Apply in the same namespace as the Kubernetes job monitor:
kubectl apply -f secret.yaml
This secret will be mounted inside the container so that kubectl can use it. The apply command below deploys the Kubernetes job monitor to the current namespace.
kubectl apply -f https://raw.githubusercontent.com/iwilltry42/rancher2-job-monitor/master/.kubernetes/job-monitor-kubeconfig.yaml
Note: You should review the manifest above, to configure the correct ingress host and Rancher URL for deep linking.
By default the Kubernetes job monitor shows the latest status of all jobs (created by cron jobs) it can find. A couple of query parameters are available.
|The title of the monitor dashboard, which is displayed at the top and used as page title
|Show only jobs in this namespace
|Show only jobs that match this selector (e.g. key1=value1,key2=value2)
?title=My Job Monitor&namespace=namespace-a&selector=group=one
?title=My Job Monitor&selector=group=two
kubectl create namespace namespace-a
kubectl create namespace namespace-b
kubectl apply -f https://raw.githubusercontent.com/iwilltry42/rancher2-job-monitor/master/.kubernetes/test-cron-jobs.yaml