Deploying PHP Guestbook application with Redis in Meshery
Introduction
In this tutorial, we will learn how to deploy a PHP Guestbook application with Redis using Meshery Playground. Meshery Playground is an interactive and collaborative live cluster environment that simplifies the deployment process and enhances user experience by providing visual tools for managing Kubernetes resources.
NOTE: If this is your first time working with Meshery Playground, consider starting with the Exploring Kubernetes Pods with Meshery Playground tutorial first.
Prerequisites
- Basic understanding of Kubernetes concepts.
- Meshery Playground access. If you don’t have an account, sign up at Meshery Playground.
Lab Scenario
- Import the PHP and Redis manifest files into Meshery Playground.
- Deploy these resources on the playground.
- Start up a Redis leader.
- Start up two Redis followers.
- Start up the guestbook frontend.
- Expose and view the Frontend Service.
Objective
Learn how to import manifest files, visualize Kubernetes resources, create new resource components, and deploy the application using Meshery Playground.
Steps
Download the Kubernetes Configuration Files
To get started we will need some yaml files that will contain the configurations for the pods and services that will run on Meshery. You can download them to see what the look like.
- redis-leader-deployment.yaml
- redis-leader-service.yaml
- redis-follower-deployment.yaml
- redis-follower-service.yaml
- frontend-deployment.yaml
- frontend-service.yaml
These YAML files contain the Service definitions and Deployment configurations for the PHP app with Redis.
Accessing Meshery Playground
-
Log in to the Meshery Playground using your credentials. On successful login, you should be at the dashboard. Press the X on the Where do you want to start? popup to close it (if required).
-
Click Explore in the Cloud Native Playground tile to navigate to MeshMap
Import the Files to Meshery Playground
-
In the left sidebar, click on the upward arrow symbol(import icon) to import the designs into Meshery.
-
On doing so, a modal appears.In the modal that appears, enter a name for your design in the “Design File Name” field (e.g.
redis-leader-deployment
). -
Now select
Kubernetes Manifest
from the “Design Type” dropdown menu. -
Then choose
URL Import
for the upload method. -
Now input the URL.
-
Then, click on
Import
Now, follow the same steps (1-6) to import the rest of the files.
Under the “Designs” tab, you will see that we have successfully imported the manifest as designs, then you can drag and drop them in the canvas. This will “Merge” all the designs since it’s all just one application
4. Deploy the files:
-
Click Actions in the top right corner and click on Deploy.
- The design will be validated to make sure there are no errors.
- Choose the Kubernetes cluster you want to deploy to.
- A Dry-Run will be triggered.
- Finally your deployment and click Deploy to deploy the application to the cluster.
- On sucessful deployment you will see the following modal asking yout o open you deployment in visualizer
5. Updating the Deployments:
kubectl set image deployment/<deployment-name> <container-name>=new-image:tag
6. Open the files in Operate
-
Once deployment is successful user can click on Open in Operate, or click on notification on top right click on the deployment successfull notification and click on Open in Operate, or directly click on the Operate tab beside Design on the design and visualize the design inside operate mode.
-
Click on the Layers option below to view all available filters. Now you can utilize this filter to visualize your design.
-
After selecting your filters, you should see a view displaying only your relevant resources.
7. Using built-in terminal for logs
-
Right click on a pod, to open the circular-content menu.
-
Select the logs option from circular-context menu, this will start the session for logs
-
Now you can use the in built terminal to view logs
8. Deleting the resources
To delete the resources, use the Undeploy option from the Design view.
Conclusion
Congratulations! You’ve successfully completed the lab on exploring Kubernetes Deployments using Meshery Playground. This hands-on experience has equipped you with practical knowledge on deploying, updating, and monitoring applications in a Kubernetes environment. Continue exploring more scenarios in the Meshery Playground to enhance your skills in container orchestration.
Suggested Reading
- Deploy AWS EC2 Instances with Meshery - Learn how to deploy and manage AWS EC2 instances through Kubernetes with Meshery, utilizing AWS Controllers for Kubernetes (ACK) to enhance cloud resource management
- Deploying Apache Cassandra with a StatefulSet in Meshery Playground - Deploy Apache Cassandra with a StatefulSet using Meshery Playground in an interactive live cluster environment.
- Exploring Kubernetes CronJobs - In this tutorial, we will explore how to use Meshery Playground, an interactive live cluster environment, to perform hands-on labs for managing Kubernetes CronJobs.
- Understanding Kubernetes ConfigMaps and Secrets with Meshery - In this tutorial, we will explore how to effectively use Kubernetes ConfigMaps and Secrets for managing configuration data and sensitive information. Leveraging Meshery Playground, an interactive live cluster environment, we'll perform hands-on labs to understand the practical aspects of working with ConfigMaps and Secrets in Kubernetes.
- Exploring Kubernetes Pods with Meshery - Explore Kubernetes Pods using Meshery in an interactive live cluster environment, through a series of hands-on excercises.
- Publishing Meshery Designs to ArtifactHub - Step by step example for how to export Meshery Designs and publish them to an ArtifactHub repository.
- Deploying WordPress and MySQL with Persistent Volumes with Meshery - Deploy a WordPress site and a MySQL database with Persistent Volumes using Meshery Playground in an interactive live cluster environment.