docs/static/v0.7/guides/tutorials/exploring-kubernetes-cronjobs/index.html
Introduction: In this tutorial, we will explore Kubernetes CronJobs, a resource that allows you to run jobs periodically at specified intervals. We will use Meshery Playground, an interactive live cluster environment, to perform hands-on labs for working with CronJobs in Kubernetes.
Prerequisites:
Lab Scenario: Scheduled Backups using CronJobs
Objective: Learn how to use Kubernetes CronJobs to schedule and automate periodic backups of a sample application.
To deploy a web application on Meshery, follow these steps:
Open the Kanvas tab located in the left panel.
Upon opening Kanvas, ensure that you are on the Design tab, which can be found at the top center of the canvas.
Navigate to the Design option located in the top menu of the left panel. Using the search bar, type in the name of your app, which in this instance is the Minecraft App.
Once your app appears in the list, click on it to upload the design file onto the canvas.
Locate the control panel at the bottom of the canvas and choose the Kubernetes option.
Using the search bar, enter “Cron Job” and click on the corresponding icon to display it on the canvas.
Once the cronjob component appears on the canvas, click on it to open the toolbar and begin configuration.
Fill out the details for the CronJob i.e Name field: “backup-cronjob”. Under Spec , enter the specifications, i.e schedule: “0 * * * *” to run every hour.
Locate the Save As icon in the top right, once the pop up modal opens, give your design a name, then click save.
Thereafter click on the Action drop down menu also located in the top right and click on the Deploy option.
In the pop-up window, review and correct any errors as necessary. Then, click the deploy button.
You’ll receive a confirmation message indicating that your app has been successfully deployed.
To view the resources created for the CronJob, we will utilize the Visualize tab of the Kanvas. A view will be created with necessary filters to display the relevant resources.
Return to the Designer tab
Select the CronJob Design: Choose the design that contains the CronJob you want to scale from the list of existing designs.
Locate the CronJob Component: Within the design canvas, identify the representation of the CronJob you wish to scale. It should be labeled as “CronJob” or have a specific icon associated with CronJobs.
Select the CronJob Component: Click on the CronJob component to open the toolbar..
Continue to configure your cronjob with your preffered specifications that match your desired scaling options.
Adjust the Number of Replicas or Parallelism: Within the toolbar, locate the field related to the number of replicas or parallelism for the CronJob. Adjust this value to scale the CronJob up or down according to your requirements.
Save Changes: After verifying the adjustments, save the changes made to the CronJob settings within the Kanvas Designer interface to ensure they are retained for future reference. <!–
Show user how to use Designs and components in Kanvas Designer.
–>
Use Meshery Playground to visualize the changes and observe the impact on the scheduled backups.
Show user how to use Designs and components in Kanvas Designer.
–>
Share your scenario with other Meshery users or the community for collaborative learning.
Congratulations! You’ve successfully completed the lab on exploring Kubernetes CronJobs using Meshery Playground. This hands-on experience has provided valuable insights into scheduling and automating tasks in Kubernetes using CronJobs. Explore more scenarios in the Meshery Playground to enhance your skills in cloud-native technologies.