Skip to content

Workaround to make K8s Jobs behave reasonable

License

Notifications You must be signed in to change notification settings

morecontainers/k8s-job-sidecar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Job sidecar termination service.

Public domain software. Original code by Henrik Holst [email protected].

Pending the availability of an upstream solution:

kubernetes/enhancements#3580

The service will send a SIGTERM to all processes once all containers has terminated, that is not included in the exclude list. The exclude list is simply the arguments given to the Service itself.

This requires shareProcessNamespace: true on the Pod.

Example use

apiVersion: batch/v1
kind: Job
metadata:
  name: api-tests
spec:
  backoffLimit: 0
  template:
    metadata:
      name: api-tests
    spec:
      shareProcessNamespace: true
      activeDeadlineSeconds: 600
      restartPolicy: Never
      imagePullSecrets:
      - name: regcred
      containers:
      - name: k8s-job-sidecar
        image: morecontainers/k8s-job-sidecar:latest
        args:
          - k8s-job-sidecar
          - socat
      - name: socat
        image: morecontainers/socat:1.7.4.2-sigterm
        args:
          - -d
          - tcp-listen:8000,reuseaddr,fork,bind=127.0.0.1
          - tcp-connect:serving:8000
      - name: api-tests
        image: myreg.io/PATH/TO/YOUR/container:latest

About

Workaround to make K8s Jobs behave reasonable

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published