Forrest logo
back to the kubectl tool

kubernetes:warp:c897a

Report when a Kubernetes job has finished
$ kubectl wait --for=condition=complete job/${job_name}
try on your machine

The command kubectl wait --for=condition=complete job/${job_name} is used in Kubernetes to wait until a specific job is in the "complete" state before moving on to the next step or command.

Here is a breakdown of the command:

  • kubectl: This is the command-line tool used to interact with Kubernetes clusters.
  • wait: This is the subcommand of kubectl used to wait until a specific condition is met.
  • --for=condition=complete: This option specifies the condition that the command should wait for. In this case, it is waiting for the job to be in the "complete" state.
  • job/${job_name}: This is the name of the job that the command is waiting for. The ${job_name} variable should be replaced with the actual name of the job.

When this command is executed, it will continuously check the status of the specified job until it is in the "complete" state. It will keep polling the Kubernetes API server and block the execution of subsequent commands until the desired condition is met. Once the job is complete, the command will exit and allow further execution.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the kubectl tool