From 0d2025fd5b8ec8c0a47b6a128c5f97f2bc9fb473 Mon Sep 17 00:00:00 2001 From: Yi Nuo <218099172+yi-nuo426@users.noreply.github.com> Date: Thu, 14 May 2026 14:13:57 -0500 Subject: [PATCH] feat(kanvas): add Kubernetes Services tutorial Migrate the Exploring Kubernetes Services with Meshery tutorial to content/en/kanvas/tutorials/kubernetes/kubernetes-services.md. - Add hands-on tutorial covering ClusterIP, NodePort, and LoadBalancer service types using Meshery Playground and Kanvas - Preserve legacy URL aliases (/guides/tutorials/kubernetes-services, /kanvas/tutorials/kubernetes-services) - Use ## / ### heading hierarchy matching existing Kanvas tutorials - Add descriptive alt text on every screenshot for accessibility - Link screenshots to existing assets on docs.meshery.io - Add intro content to kubernetes/_index.md Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Yi Nuo <218099172+yi-nuo426@users.noreply.github.com> --- .../en/kanvas/tutorials/kubernetes/_index.md | 12 +- .../kubernetes/kubernetes-services.md | 295 ++++++++++++------ 2 files changed, 201 insertions(+), 106 deletions(-) diff --git a/content/en/kanvas/tutorials/kubernetes/_index.md b/content/en/kanvas/tutorials/kubernetes/_index.md index 933a0fa6140..7f11109d483 100644 --- a/content/en/kanvas/tutorials/kubernetes/_index.md +++ b/content/en/kanvas/tutorials/kubernetes/_index.md @@ -1,3 +1,11 @@ --- -title: Kubernetes ---- \ No newline at end of file +title: Kubernetes +description: Hands-on Kubernetes tutorials using Meshery Playground and Kanvas. +weight: 9 +categories: [Tutorials] +--- + +Work through hands-on Kubernetes scenarios in +[Meshery Playground](https://playground.meshery.io/) — an interactive live +cluster environment — using Kanvas to design, deploy, and explore core +Kubernetes resources without writing YAML. diff --git a/content/en/kanvas/tutorials/kubernetes/kubernetes-services.md b/content/en/kanvas/tutorials/kubernetes/kubernetes-services.md index b4a16c43d9e..f7da3995a64 100644 --- a/content/en/kanvas/tutorials/kubernetes/kubernetes-services.md +++ b/content/en/kanvas/tutorials/kubernetes/kubernetes-services.md @@ -3,187 +3,274 @@ title: Exploring Kubernetes Services with Meshery model: kubernetes params: kind: services -categories: [tutorials] -description: Explore Kubernetes Services using Meshery using Meshery Playground, an interactive live environment, through a series of hands-on exercises. -aliases: -- /kanvas/tutorials/kubernetes-services +categories: [Tutorials] +description: + Explore Kubernetes Services using Meshery Playground, an interactive live + environment, through a series of hands-on exercises. +weight: 3 +aliases: + - /guides/tutorials/kubernetes-services + - /guides/tutorials/kubernetes/kubernetes-services + - /kanvas/tutorials/kubernetes-services --- -### Introduction +## Introduction -In this tutorial, we'll learn to implement Kubernetes **Services**, the resources responsible for exposing applications inside and outside the cluster. Using Meshery Playground, an interactive live cluster environment, we'll perform hands-on labs to gain practical experience with the Kubernetes Services, without writing any YAML. +In this tutorial, we'll learn to implement Kubernetes **Services**, the +resources responsible for exposing applications inside and outside the cluster. +Using Meshery Playground, an interactive live cluster environment, we'll perform +hands-on labs to gain practical experience with Kubernetes Services, without +writing any YAML. -> **NOTE:** If this is your first time working with Meshery Playground, consider starting with the [Exploring Kubernetes Pods with Meshery Playground](/kanvas/tutorials/kubernetes-pods) tutorial first or [Exploring Kubernetes Deployments with Meshery](/kanvas/tutorials/kubernetes-deployments). +> **NOTE:** If this is your first time working with Meshery Playground, consider +> starting with the +> [Exploring Kubernetes Pods with Meshery Playground](https://docs.meshery.io/guides/tutorials/kubernetes-pods) +> tutorial first or +> [Exploring Kubernetes Deployments with Meshery](https://docs.meshery.io/guides/tutorials/kubernetes-deployments). - -### Prerequisites +## Prerequisites - Basic understanding of containerization and Kubernetes concepts. -- Access to the _Meshery Playground_. If you don't have an account, sign up at [Meshery Playground](https://playground.meshery.io/). +- Access to the _Meshery Playground_. If you don't have an account, sign up at + [Meshery Playground](https://playground.meshery.io/). + +## Lab Scenario -### Lab Scenario +Deploy a simple application or a simple Pod and expose it using ClusterIP, +NodePort, and LoadBalancer services. Each service will route traffic to the pods +via a common label selector. We’ll inspect the service details in Operator mode +to confirm their types and behavior. -Deploy a simple application or a simple Pod and expose it using ClusterIP, NodePort, and LoadBalancer services. Each service will route traffic to the pods via a common label selector. We’ll inspect the service details in Operator mode to confirm their types and behavior. +## Objective -### Objective +Learn how to create, manage, and explore _Kubernetes Services_ to expose +applications within the context of a microservices architecture. -Learn how to create, manage, and explore _Kubernetes Services_ to expose applications within the context of a microservices architecture. +## Steps -### Steps +### Access Meshery Playground -#### Access Meshery Playground -- Log in to the [Meshery Playground](https://playground.meshery.io/) using your credentials. +- Log in to the [Meshery Playground](https://playground.meshery.io/) using your + credentials. - On successful login, you should be at the dashboard. -- Click **Kanvas** from the left menu to navigate to the [_Kanvas_ design](https://kanvas.new/extension/meshmap) page. +- Click **Kanvas** from the left menu to navigate to the + [_Kanvas_ design](https://kanvas.new/extension/meshmap) page. - ![](/kanvas/tutorials/images/kubernetes-deployments/2025-02-27_16-59.png) + ![Kanvas Design page in Meshery Playground showing the empty design canvas](https://docs.meshery.io/guides/tutorials/images/kubernetes-deployments/2025-02-27_16-59.png) > **_NOTE:_** Kanvas is still in beta. +### Create a Deployment + +1. In the _Kanvas Design_ page, start by renaming the design to a name of your + choice for easier identification later. + + ![Kanvas design renamed from Untitled Design to a custom name](https://docs.meshery.io/guides/tutorials/images/kubernetes-services/2025-09-04_02.png) + +2. From the floating dock below, click the **Kubernetes** icon and then click + **Deployment** from the list. This will create the _Deployment_ component on + the design canvas. -#### Create a Deployment + ![Selecting the Deployment component from the Kubernetes icon in the floating dock](https://docs.meshery.io/guides/tutorials/images/kubernetes-services/2025-09-04_03.png) -1. In the _Kanvas Design_ page, start by renaming the design to a name of your choice for easier identification later. +3. Click or Drag the _Deployment_ component onto the canvas and the + **Configure** tab automatically opens. - ![](/kanvas/tutorials/images/kubernetes-services/2025-09-04_02.png) + ![Configure tab opening after dragging the Deployment component onto the canvas](https://docs.meshery.io/guides/tutorials/images/kubernetes-services/2025-09-04_04.png) -2. From the floating dock below, click the **Kubernetes** icon and then click **Deployment** from the list. This will create the _Deployment_ component on the design canvas. +4. Change the **Name** of the deployment and the **Namespace** if required. For + this demonstration, we will leave them as they are and deploy this to the + _default_ namespace. - ![](/kanvas/tutorials/images/kubernetes-services/2025-09-04_03.png) +5. Set **Replicas** to `2`. Under **Selector** and **MatchLabels**, set a + _matchLabel_ pair. Here we have set `app:9988110`. -3. Click or Drag the _Deployment_ component onto the canvas and the **Configure** tab automatically opens. + ![Replicas set to 2 with matchLabels app:9988110 under the Selector section](https://docs.meshery.io/guides/tutorials/images/kubernetes-services/2025-09-04_05.png) - ![](/kanvas/tutorials/images/kubernetes-services/2025-09-04_04.png) - -4. Change the **Name** of the deployment and the **Namespace** if required. For this demonstration, we will leave them as they are and deploy this to the _default_ namespace. - -5. Set **Replicas** to `2`. Under **Selector** and **MatchLabels**, Set a _matchLabel_ pair. Here we have set `app:9988110`. - ![](/kanvas/tutorials/images/kubernetes-services/2025-09-04_05.png) +6. Under **Template → Metadata → Labels**, add the same label `app:9988110`. -6. Under **Template → Metadata → Labels**, add the same label `app:9988110`. - ![](/kanvas/tutorials/images/kubernetes-services/metadata.png) + ![Adding the matching label app:9988110 under Template Metadata Labels](https://docs.meshery.io/guides/tutorials/images/kubernetes-services/metadata.png) +7. While still under **Template**, click **Spec** to load the _spec_ + configuration modal. Then scroll down and click **+ Add Item** next to + **Containers**. This will create a container **Containers 1**. Click on it + and add: + - **Image**: `meshery/meshery-milestone:latest` + - **Name**: `meshery-milestone` -7. While still under **Template**, click **Spec** to load the _spec_ configuration modal. Then scroll down and click **+ Add Item** next to **Containers**. This will create a container **Containers 1**. Click on it and add: -- **Image**: `meshery/meshery-milestone:latest` -- **Name**: `meshery-milestone` - ![](/kanvas/tutorials/images/kubernetes-services/2025-09-04_06.png) + ![Containers 1 configured with image meshery/meshery-milestone:latest and name meshery-milestone](https://docs.meshery.io/guides/tutorials/images/kubernetes-services/2025-09-04_06.png) -8. Click outside to close the modal. The deployment is now ready and it will look similar to this: - ![](/kanvas/tutorials/images/kubernetes-services/2025-09-04_07.png) +8. Click outside to close the modal. The deployment is now ready and it will + look similar to this: + ![Completed Deployment component on the Kanvas design canvas](https://docs.meshery.io/guides/tutorials/images/kubernetes-services/2025-09-04_07.png) -9. Validate and Deploy the design: Click Validate (**Actions** toolbar), ensure that there are no errors and then click Deploy. Wait for the deployment to complete (Notifications will appear on bottom right). +9. Validate and Deploy the design: Click Validate (**Actions** toolbar), ensure + that there are no errors and then click Deploy. Wait for the deployment to + complete (Notifications will appear on bottom right). -##### You have now deployed a Deployment with 2 pods running in the cluster. +#### You have now deployed a Deployment with 2 pods running in the cluster. --- -#### Add a ClusterIP Service +### Add a ClusterIP Service -1. From **Components**, search for **Service** and drag it to the canvas, rename the service, here I will go with `service-clusterip`. Click on the service component to open its config modal. - ![](/kanvas/tutorials/images/kubernetes-services/2025-09-04_08.png) +1. From **Components**, search for **Service** and drag it to the canvas, rename + the service, here I will go with `service-clusterip`. Click on the service + component to open its config modal. -2. In the service configuration modal: -- Set **Type** to `ClusterIP`. -- Click on **+ Add Item** under Ports to add a port called **Ports 1**. Click on it and add: - - **Port**: `80` - - **TargetPort**: `80` (These match the container port that our image serves on.) -- Also add the same key value pair as before under **Selector**: `app:9988110` -- We will also add the same label as the deployment for easier identification in Operator Mode. - ![](/kanvas/tutorials/images/kubernetes-services/edit-01.png) + ![Service component renamed to service-clusterip on the Kanvas canvas](https://docs.meshery.io/guides/tutorials/images/kubernetes-services/2025-09-04_08.png) +2. In the service configuration modal: + - Set **Type** to `ClusterIP`. + - Click on **+ Add Item** under Ports to add a port called **Ports 1**. Click + on it and add: + - **Port**: `80` + - **TargetPort**: `80` (these match the container port that our image + serves on). + - Also add the same key value pair as before under **Selector**: + `app:9988110`. + - We will also add the same label as the deployment for easier identification + in Operator Mode. -3. Connect the Service to the Deployment: Click over the service component until green dots appear, click the arrow and select network. Drag to the deployment. This creates a Network link. - ![](/kanvas/tutorials/images/kubernetes-services/2025-12-13_1.png) + ![ClusterIP service configured with port 80, targetPort 80, and selector app:9988110](https://docs.meshery.io/guides/tutorials/images/kubernetes-services/edit-01.png) -From the Actions Tab, Undeploy the deployment first and then, validate and dry-run the new design, resolve any errors that may arise. Now, deploy the design. A pop up in the bottom right will confirm that the design is successfully configured. +3. Connect the Service to the Deployment: Click over the service component until + green dots appear, click the arrow and select network. Drag to the + deployment. This creates a Network link. - ![](/kanvas/tutorials/images/kubernetes-services/2025-12-13_2.png) + ![Network link drawn between the Service and Deployment components](https://docs.meshery.io/guides/tutorials/images/kubernetes-services/2025-12-13_1.png) -Switch to Operator mode, explore the Service details. Select the `service-clusterip` resource to see its details. - ![](/kanvas/tutorials/images/kubernetes-services/2025-09-05_11.png) +From the Actions Tab, Undeploy the deployment first and then validate and +dry-run the new design, resolving any errors that may arise. Now, deploy the +design. A pop-up in the bottom right will confirm that the design is +successfully configured. -Notice the ClusterIP listed under Addresses and that no external IP or NodePort is assigned. This confirms that a ClusterIP service provides an internal IP reachable only within the cluster. -This Service has a ClusterIP (10.98.146.20) and a selector (app=9988110). Any Pod with that label automatically becomes part of the Service’s backend. This label-to-Pod binding is how a ClusterIP Service internally routes traffic to its backing workloads. - ![](/kanvas/tutorials/images/kubernetes-services/2025-09-05_12.png) +![Deploy success pop-up in the bottom right corner of the Kanvas page](https://docs.meshery.io/guides/tutorials/images/kubernetes-services/2025-12-13_2.png) +Switch to Operator mode and explore the Service details. Select the +`service-clusterip` resource to see its details. + +![service-clusterip details panel in Operator mode](https://docs.meshery.io/guides/tutorials/images/kubernetes-services/2025-09-05_11.png) + +Notice the ClusterIP listed under Addresses and that no external IP or NodePort +is assigned. This confirms that a ClusterIP service provides an internal IP +reachable only within the cluster. This Service has a ClusterIP (10.98.146.20) +and a selector (app=9988110). Any Pod with that label automatically becomes part +of the Service’s backend. This label-to-Pod binding is how a ClusterIP Service +internally routes traffic to its backing workloads. + +![ClusterIP address and selector details for service-clusterip in Operator mode](https://docs.meshery.io/guides/tutorials/images/kubernetes-services/2025-09-05_12.png) --- -#### Add a NodePort Service - -To allow external access, we’ll use a NodePort service. For simplicity, I will switch from using deployment to Pod for our next Service. +### Add a NodePort Service + +To allow external access, we’ll use a NodePort service. For simplicity, I will +switch from using a Deployment to a Pod for our next Service. + +1. Back in Design mode, drag a Pod from the dock onto the canvas. Scroll down + within the Pod configuration modal to the Containers section. Click **+** to + add a container. Expand **Containers-1**. Next, fill out some of the required + container specifications. Start by entering the container image — we will use + _meshery/meshery-milestone:latest_ for this exercise. Give the container a + name and a unique label (this unique label will be used by the service + selector). -1. Back in Design mode, we will drag a Pod from the dock onto the canvas. Scroll down within the Pod configuration modal to the Containers section. Click **+** to add a container. Expand **Containers-1**. Next, fill out some of the required container specifications. Start by entering the container image, we will use _meshery/meshery-milestone:latest_ for this exercise. Give the container a name and a unique label (This unique label will be used by the service selector.). - ![](/kanvas/tutorials/images/kubernetes-services/2025-09-06_13.png) + ![Pod component with a container configured using meshery/meshery-milestone:latest and a unique label](https://docs.meshery.io/guides/tutorials/images/kubernetes-services/2025-09-06_13.png) -2. Now, drag a Service component onto the canvas and rename it to `service-nodeport`. +2. Now, drag a Service component onto the canvas and rename it to + `service-nodeport`. -3. Under the config modal, set **Type** to `NodePort` and the same selector as the Pod label, so that our Service is able to connect with our Pod. - ![](/kanvas/tutorials/images/kubernetes-services/2025-09-06_14.png) +3. Under the config modal, set **Type** to `NodePort` and the same selector as + the Pod label, so that our Service is able to connect with our Pod. -4. Click on **+ Add Item** under Ports to reveal **Ports 1**, expand **Ports 1** and add: -- **Port**: `80` -- **TargetPort**: `80` -- **NodePort**: `30091` (or leave blank to auto-assign). - ![](/kanvas/tutorials/images/kubernetes-services/2025-09-06_15.png) + ![Service type set to NodePort with selector matching the Pod label](https://docs.meshery.io/guides/tutorials/images/kubernetes-services/2025-09-06_14.png) +4. Click on **+ Add Item** under Ports to reveal **Ports 1**, expand **Ports + 1**, and add: + - **Port**: `80` + - **TargetPort**: `80` + - **NodePort**: `30091` (or leave blank to auto-assign). + + ![NodePort service configured with port 80, targetPort 80, and nodePort 30091](https://docs.meshery.io/guides/tutorials/images/kubernetes-services/2025-09-06_15.png) 5. Validate and deploy from the Action tab at the top right. - ![](/kanvas/tutorials/images/kubernetes-services/2025-12-13_3.png) -Now switch to Operator mode, click on any component to view details(like type or selector) about the Service or the Pod. - ![](/kanvas/tutorials/images/kubernetes-services/2025-12-13_4.png) + ![Deploy action confirmation for the NodePort design](https://docs.meshery.io/guides/tutorials/images/kubernetes-services/2025-12-13_3.png) + +Now switch to Operator mode and click on any component to view details (like +type or selector) about the Service or the Pod. + +![NodePort service component details in Operator mode showing service type and selector](https://docs.meshery.io/guides/tutorials/images/kubernetes-services/2025-12-13_4.png) + +Note that this service is mapped to a NodePort and is accessible on the **Node’s +IP address**. + +Expand the details section and you will see a NodePort value (30091); this means +the service is exposed on each Node’s IP at port 30091. You can access the app +externally via `http://:30091`. -Note that this service is mapped NodePort and is accessible on the **Node’s IP address**. +![NodePort details showing the assigned port 30091 in Operator mode](https://docs.meshery.io/guides/tutorials/images/kubernetes-services/2025-09-06_17.png) -Expand the details section and you will see a NodePort value (30091), this means the service is exposed on each Node’s IP at port 30091. You can access the app externally via `http://:30091`. - ![](/kanvas/tutorials/images/kubernetes-services/2025-09-06_17.png) +The Operator mode also provides an interactive terminal, along with other +Details about the Pod. Click on the Pod to reveal the +`Initiate Terminal Session` option. +![Pod details panel showing the Initiate Terminal Session option in Operator mode](https://docs.meshery.io/guides/tutorials/images/kubernetes-services/2025-12-13_5.png) -The Operator mode also provides an interactive terminal, along with other Details about the Pod. Click on the Pod to reveal the `Initiate Terminal Session` option. - ![](/kanvas/tutorials/images/kubernetes-services/2025-12-13_5.png) - -> **_NOTE:_** In Meshery Playground, Node IPs may not be directly reachable from your local machine due to the sandboxed environment. The NodePort value confirms that the Service is correctly exposed by Kubernetes, even if direct browser access is restricted. +> **_NOTE:_** In Meshery Playground, Node IPs may not be directly reachable from +> your local machine due to the sandboxed environment. The NodePort value +> confirms that the Service is correctly exposed by Kubernetes, even if direct +> browser access is restricted. --- +### Add a LoadBalancer Service -#### Add a LoadBalancer Service +Finally, we’ll create a LoadBalancer service. In a real cloud environment, this +would provision an external load balancer. In Meshery Playground, you will see +how the service object is defined, even though a real cloud IP isn’t provided. -Finally, we’ll create a LoadBalancer service. In a real cloud environment, this would provision an external load balancer. In Meshery Playground, you will see how the service object is defined, even though a real cloud IP isn’t provided. +1. In Design mode, add another Pod to the canvas (as before). Add a container + with Name `meshery-milestone`, Image `meshery/meshery-milestone:latest`, and + add label `app:8080` (or any unique label). -1. In Design mode, add another Pod to the canvas (as before). Add a container with Name `meshery-milestone`, Image `meshery/meshery-milestone:latest`, and add label `app:8080` (or any unique label). -2. Drag a Service component onto the canvas, rename it `service-loadbalancer`. -3. In the service’s Configure panel, set **Type** to `LoadBalancer`. Under Selector, add `app:8080`. -4. Under Ports, click **+ Add Item**. Expand **Ports 1** and set: -- **Port**: `80` -- **TargetPort**: `80` +2. Drag a Service component onto the canvas, rename it `service-loadbalancer`. +3. In the service’s Configure panel, set **Type** to `LoadBalancer`. Under + Selector, add `app:8080`. -5. Close the panel. - ![](/kanvas/tutorials/images/kubernetes-services/2025-12-13_6.png) +4. Under Ports, click **+ Add Item**. Expand **Ports 1** and set: + - **Port**: `80` + - **TargetPort**: `80` +5. Close the panel. -6. Validate and Deploy (undeploy the old design first). + ![LoadBalancer service-loadbalancer configured with type LoadBalancer and selector app:8080](https://docs.meshery.io/guides/tutorials/images/kubernetes-services/2025-12-13_6.png) -In Operator mode, observe the LoadBalancer service. In a real Kubernetes environment, a LoadBalancer provides an **external IP address**. - ![](/kanvas/tutorials/images/kubernetes-services/2025-12-13_7.png) +6. Validate and Deploy (undeploy the old design first). + +In Operator mode, observe the LoadBalancer service. In a real Kubernetes +environment, a LoadBalancer provides an **external IP address**. + +![LoadBalancer service details in Operator mode](https://docs.meshery.io/guides/tutorials/images/kubernetes-services/2025-12-13_7.png) --- -### Cleaning Up +## Cleaning Up -To remove all the resources you created in this tutorial: in Design mode, go to Actions → Undeploy and confirm. This will delete the Deployments/Pods and Services from the cluster. +To remove all the resources you created in this tutorial: in Design mode, go to +Actions → Undeploy and confirm. This will delete the Deployments/Pods and +Services from the cluster. --- -### Conclusion +## Conclusion -Congratulations! You've successfully completed the lab on exploring Kubernetes Services with Meshery Playground. You created and deployed a sample application, then exposed it with different Service types (ClusterIP, NodePort, LoadBalancer). +Congratulations! You've successfully completed the lab on exploring Kubernetes +Services with Meshery Playground. You created and deployed a sample application, +then exposed it with different Service types (ClusterIP, NodePort, +LoadBalancer). Continue exploring more scenarios in the Meshery Kanvas to enhance your skills. - - ----