I have a simple job that is defined in a YAML file similar to the one below:

apiVersion: batch/v1
kind: Job
  name: check_deps
      - name: production-container
        image: registry.company.com/app:master
        imagePullPolicy: Always
        - configMapRef:
            name: production
        - python
        - check_dependencies
      restartPolicy: Never

I want to trigger this job from the CI, and receive an information if it failed or succeeded.
Just a simple command like:

kubectl run job --name=check_deps --watch

The documentation says, that I need to create job from yaml, read its output and then delete it in 3 separate steps. I can create a script to do that, but maybe there is a built in solution that would allow me to achieve my goal?

I'm running kubernetes on bare metal CentOs, vesion 1.11 of client and server.


There is no such build-in functionality in Kubernetes. You can use kubectl create command but you still have to write your own script for running it and checking statuses.


You could run kubectl wait --for=condition=complete job/check_deps. You still need to create and remove you job before and after, but with that command you should end up with a rather clean and simple approach after all.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.