Defining K8s Execute Command Job Properties

{"URL":["/*.*/awa/pa_view_pa_view_EXECUTE_COMMAND_JOB_k8s"],"heroDescriptionIdentifier":"ice_hero_K8_Execute_Command_Job","customCards":[{"id":"ice_specific_K8s_Execute_Command_Job","title":"Adding Execute Command Job Parameters","type":"customize","url":"https://docs.automic.com/documentation/webhelp/english/ALL/components/IG_K8S/*.*/Agent%20Guide/Content/Kubernetes/K8s_ExecuteCommand_Job.htm","languages":["en-us"]},{"id":"ice_RA_Integration_Report","title":"RA / Integration Reports","type":"customize","url":"https://docs.automic.com/documentation/webhelp/english/ALL/components/IG_K8S/*.*/Agent%20Guide/Content/Kubernetes/K8s_RA_Page.htm","languages":["en-us"]},{"id":"ice_script_K8s_Execute_Command_Job","title":"Setting Execute Command Job Properties through Scripts","type":"customize","url":"https://docs.automic.com/documentation/webhelp/english/ALL/components/IG_K8S/*.*/Agent%20Guide/Content/Kubernetes/K8s_Script.htm","languages":["en-us"]},{"id":"ice_related_information_K8_Execute_Command_Job","title":"Related Information","type":"customize","url":"https://docs.automic.com/documentation/webhelp/english/ALL/components/IG_K8S/*.*/Agent%20Guide/Content/Kubernetes/K8s_ExecuteCommand_Job.htm","languages":["en-us"]}]}
define Kubernetes execute command jobs, defining Kubernetes execute command jobs

This job allows you to execute commands in one or more pods. The command is executed in one pod after the other, if the pod is active.

  • Connection

    Select the K8s Connection object containing the relevant information to connect to the K8s system.

    To search for a Connection object, start typing its name to limit the list of the objects that match your input.

  • Namespace

    Define the namespace in which you want to execute the commands. You can click the browse button to the right of the field to open a picker dialog where you can select the relevant name.

  • Command

    Define the command to be executed in the pods.

    Note:

    To be able to execute an application command, you must set the shell beforehand. For example, to run the command java -version, you must set the shell as follows: bash -c "java -version".

  • Label Selector

    Define the labels you want to use to filter the pods, for example, environment=test.

  • Field Selector

    Define the fields you want to use to filter the pods, for example, metadata.name=my-service.

    You can also use a combination of Label and Field Selectors.

  • Execute In:

    • All Pods

      When the scope is set to All Pods and a Label Selector and/or Field Selector is used to identify pods, the command will be executed in all the running pods from the identified list. For example, if a label selector identifies fouractive pods, the command will be executed in all four of those pods.

    • Any Pod

      This field will pickup any active pod and execute the command there. Rest pods will be skipped.

  • Pod Name

    (Optional) If you know the pod name, you can input it, and the command will execute in that specific pod.

  • Container Name

    (Optional) If you know the container name inside the pod, you can provide both the pod name and the container name. In this case, the commands will be executed within that specific container.

    If you specify the container name, the command will always be executed in the given container. If container does not exist in the pod, it will fail the job.

Note:

None of the fields support regular expressions.

Important!

The job will fail if any of the following occur:

  • No active pods are found.

  • The command execution fails.

  • The specified container name does not exist inside the pod.

Note:

The Pre-Process page allows you to define the settings of all K8s Jobs using script statements. These statements are processed before the Schedule Job is executed, see Setting Kubernetes Job Properties Through Scripts.

See also: