Kubectl Workflow
A Kubectl workflow provides a direct way to interact with a Kubernetes cluster, allowing teams to manage resources, deploy applications, and troubleshoot issues using kubectl
commands.
For example, when scaling an application or deploying a new version, a Kubectl workflow would execute the necessary kubectl
commands to update the deployment, manage services, or monitor the status of resources in the cluster.
Create a Kubernetes Workflow​
Subscribe and use StackGuardian's kubernetes-template. This template provides a pre-configured environment for managing Kubernetes clusters with tools like kubectl and Helm.
Following this guide, let's configure a Kubernetes workflow.
-
Navigate into the Workflow Group, click Create Workflow and choose "Use Wizard" > "Custom".
-
StackGuardian provides two options:
- Enable VCS settings to connect your code from the Git repository by providing the URL, then click "Next".
- Or simply, click "Next" to proceed without it.
-
To create an apply action (used to apply Kubernetes manifests), click on "Add New Step" and configure it as follows:
- Step Name: Enter a relevant name, such as "apply-manifest".
- Workflow Step Template: Select
/stackguardian/kubernetes
. - Workflow Step Template Revision: Choose the latest, e.g.,
kubernetes:4
. - Command Override: Leave blank unless customization is needed.
- Kubectl Version: Choose the latest version.
1.26.0
- Namespace: Set to
default
or specify a custom namespace. - Select Executable: Choose
kubectl
. - Kubectl Action: Select
apply
(other options includeget
to retrieve resources, anddelete
to remove resources). - Run with --dry-run: Check this if you want to simulate the action without actually executing it.
- Additional Parameters: Optional; used for referencing output or vault secrets from other workflows.
-
After configuring the step, click Next to fill in the workflow metadata. Finally, click Next to launch the workflow.
Fig: Kubernetes workflow type
Using this setup, you can create and manage Kubernetes workflows for applying manifests, retrieving resources, and deleting them as needed. You can also create a workflow step to delete or get resources based on your specific requirements.
Dive into Workflow​
StackGuardian workflows provide multiple tabs for monitoring, managing, and refining your deployments. Each tab offers specific insights and actions to optimize your workflow experience.
Overview​
The Overview tab highlights key workflow details, including compliance check results, cost estimations, and resource summaries like drift detection and schedules. It offers a quick snapshot of your workflow's status.
Learn more in the Workflow Overview Guide.
Runs​
The Runs tab lists all executions with real-time status, unique run IDs, and metadata, such as user actions and modification timestamps. Click a Run ID to view detailed logs and execution progress.
Explore the Workflow Runs Guide.
Outputs​
The Outputs tab displays execution results and downloadable artifacts like tfstate.json
. Use key-value pairs to reference outputs in other workflows, making your infrastructure provisioning more dynamic.
See the Workflow Outputs Guide.
Settings​
The Settings tab enables post-creation updates, such as modifying input variables, refining Terraform runtime settings, reordering custom steps, or managing cloud connectors and environment variables.
Learn more in the Workflow Settings Guide.