
Argo Workflows is an open source Workflow engine used to orchestrate multiple Kubernetes Jobs. A Workflow is an instance of a defined set of steps in which many individual Jobs are executed in parallel or a sequence. You can use Argo Workflows to create CI/CD pipelines, orchestrate data pipelines, and automate complex tasks while leveraging the Kubernetes Cluster Infrastructure.
This article explains how to set up Argo Workflows on a Vultr Kubernetes Engine (VKE) cluster. To implement Workflows, you will explore available templates and create a sample Workflow to manage in a cluster.
Before you begin:
3 nodes.Create a new Argo Workflows namespace to separate cluster resources.
Install the latest Argo Workflows release file that includes all essential components.
This article uses version 3.4.10. Visit the Argo Workflows releases page to use the latest version.
Verify that all necessary resources are installed and available in the Argo Workflows namespace.
The Argo Server provides a graphical web interface through which you can view and manage all Workflows available in your cluster. To access the Argo user interface, you must activate any of the following authentication methods:
Follow the steps below to set the authentication method and access the Argo Interface.
For the best results, patch the Argo Workflows deployment to change the authentication mode to Server Authentication.
Output:
Patch the Argo Server service to change the access type to LoadBalancer and activate the external IP Address value.
Output:
Wait for at least 3 minutes and view the generated argo-server external IP Address value.
Your output should look like the one below:
Using a web browser such as Chrome, access the external IP Address on port 2746 to access the Argo Server web interface. Replace 192.168.0.30
If you receive an untrusted SSL certificate connection Error. Accept the risk to skip the warning and access the Argo UI dashboard.
Argo Workflows is a Custom Resource Definition (CRD) implemented by its own controller. You can manage Argo Workflows using kubectl, Argo CLI, and the Argo UI dashboard. It includes two core concepts Workflow and Template.
In Argo Workflows, a Workflow is treated as a live object and represents two entities:
A template is a reusable named definition of an entity used as an individual step of a Workflow.You can define a template once and use it as multiple steps in a Workflow. In Argo, a template is defined in the spec.templates field with a - name property that defines its name together with other definitions.
There are six types of Argo templates:
Container: Uses an image container similar to other Kubernetes API objects. For example:
Script: It's based on the container type template and allows you to run a script within the container defined in the source sub-field. For example:
Resource: Performs a specific action (create, delete, patch, among others) on existing Kubernetes objects in a cluster. The spec of the operation is defined in the manifest sub-field. For example:
Suspend: Suspend the execution of a Workflow. You can use this type of template to handle a step that requires other conditions to be met within the cluster. For example:
Steps: Orchestrates a sequence of steps in which each step may run a set of templates in a sequence or parallel defined within the steps sub-field. The outer steps (prefixed with - -) are executed in a sequence while each step can have a set of inner steps (prefixed with a single -) that run in parallel. For example:
In the above template steps, step1 runs first, then step2a-parallel and step2b-parallel run in parallel. After that, the Workflow moves to step3.
DAG: Directed Acyclic Graph (DAG) calls other templates and orchestrates them. You can make an individual step dependent upon the completion of any previous step. A step can only execute if its dependent steps are completed as illustrated in the following example:
In the above template, the list of steps is defined within the dag.tasks section. Task B is dependent upon the completion of task A. Task C has no dependencies, so it runs as soon as it's turn comes up.
Using a text editor such as Vim, create a new Workflow resource YAML file.
Add the following contents to the file.
Save and close the file.
Below are the components of the above spec file:
apiVersion for Argo Workflow is argoproj.io/v1alpha1kind is WorkflowgenerateName: Acts as a prefix for the name of pods that are created for the Workflow. The Argo Controller names all pods in the Workflow by adding a unique suffix to this valuespec: Specifies the Workflow itself. It contains information about all the steps of a Workflow and template definitionsentrypoint: Specifies the template name that acts as the first step of the Workflowtemplates: Contains the template definitions. All templates defined in this field can be used within the Workflow.container: Sets the Argo Workflow template definition type to Container.Create the Workflow in your cluster
Output:
In your web browser, access the Argo UI dashboard.
On the left navigation bar, click the Workflow Templates menu item to open the Workflow templates page.
Rename the NAMESPACE field to argo and press Enter to apply new templates to the namespace.
Click the CREATE NEW WORKFLOW TEMPLATE button to open a new template pop-up side panel.
Click within the Manifest tab field prefilled with demo values. Press Ctrl + A to select all values, then, paste the following contents to replace the existing values in the field.
Click the CREATE button on the top bar to create the new Workflow.
On the new template details page, click the SUBMIT button to apply changes, then verify the assigned labels and click SUBMIT in the new side panel to apply changes to your cluster.
Monitor the Workflow deployment progress to your cluster, and verify that a green checkmark node displays when successful.
View the list of all available Workflows in the argo namespace.
Output:
If any Workflow fails, the error code displays in the MESSAGE output similar to the output below:
For example, in the above output, the Workflow failed with the Error (exit code 127).
View the pods associated with this Workflow. For example,hello-world-qnfj8-hfm7j.
Output:
View the pod logs, for example pod hello-world-c8wrx-rvm9f
Output:
As displayed in the above output, the prompt message you declared in your Workflow template file displays in the Workflow Pod logs.
You have set up Argo Workflows on a Vultr Kubernetes Engine (VKE) cluster and explored the core Workflow components. In addition, you created a sample Workflow in the cluster and managed the resource by viewing the respective pod logs. For more information and code samples, visit the official Argo Workflows documentation.
0 Comments
Be the first to comment and share your perspective with the community.