Project: Meshery (Provisioning / Automation & Configuration)
File: kubernetes-pods.md

layout: default title: Exploring Kubernetes Pods with Meshery abstract: Learn Kubernetes Pods permalink: guides/tutorials/kubernetes-pods model: kubernetes kind: pods type: guides category: tutorials language: en list: include abstract: "Explore Kubernetes Pods using Meshery in an interactive live cluster environment, through a series of hands-on excercises." In this tutorial, we'll learn the fundamentals of Pods, the smallest deployable units in the Kubernetes ecosystem. Using Meshery Playground, an interactive live cluster environment, we'll perform hands-on labs to gain practical experience in deploying, managing, and understanding some of the concepts related to Pods. _NOTE:_ This tutorial demonstrates stand alone pods, i.e. pods not managed through deployments. Basic understanding of containerization and Kubernetes concepts. Access to the Meshery Playground. If you don't have an account, sign up at . Deploy and explore an NGINX pod in a Kubernetes cluster. Additionally, expose the pod through a service. Learn how to create, manage, and explore Kubernetes Pods and Services within the context of a microservices architecture. Log in to the 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. _NOTE:_ MeshMap is still in beta. In the MeshMap screen, rename the design from Untitled Design to a name of choice. This helps in identifying the design later easily. Click Components tab. Search for Pod in the list of components. Scroll down, select and drag the Pod component from the search results to the design canvas on the right. You should now have a pod in the design canvas for further configuration. It has a default name assigned to it. Click the pod component to load the configuration modal. Rename the pod, if necessary. The pod at this stage does not have a container, so we will add one. This is similar to defining the containers in the spec: section of a YAML file. For this hands-on we will make some basic and necessary configurations only. Scroll down within the Pod configuration modal to the Containers section. Click + to add a container. Expand Containers-0. Next, fill out some of the required container specifications. Start by entering the container image, we will use nginx:latest for this exercise. Give the container a name. Additionally, we will also give it a label. This will server many advantages later in this exercise. To do so, click the label icon on the modal. Click + next to Labels. Set any label of choice. Preferably, give a unique label since the playground is a shared environment. Click outside to close the modal. The next step in this process is to validate the design, after which we can deploy it. To do this, click Validate on the top. This should show a pop-up with details such as the number of components, annotations and errors (if any). Ensure there are no errors before deploying. To deploy, click the Deploy (1) tab in the pop-up modal and then click Deploy (2) again. You should see a few alerts on the bottom right about the

To view the resources deployed we will use the Visualize section of the MeshMap. A view is created with necessary filters to show the relevant resources. Click Visualize to begin. Give the view a name (rename). Click the filter icon. Choose appropriate filters, for this hands-on choose the label that was set earlier during the pod creation. This helps in showing limited resources in the view. Click the filter icon again to close. This should show a filtered view with only your resources something similar to the screenshot below: Select the Details tab and select the pod from the view to view details about the pod. The details tab shows the following: Pod state, a green check means running. The namespace where the pod is running. Image details of the container in the pod like image tag and name. It also shows the number of restarts and uptime. Meshery Playground provides terminal capabilities to connect to the container(s) and stream logs. The following steps demonstrate this. Select the Pod (or container). If you have multiple containers in a pod, select a container. Select the Actions tab to the right. Click Open Interactive Terminal. This displays the terminal on the screen. To view streaming logs, click Stream Container Logs to the right and an additional logs view is added to the terminal window. _NOTE:_ As of this writing, Meshery Playground supports only NodePort at the moment. Go back to the Design view. From Components search for service and the drag the service component to the design canvas. Click the service component to load the configuration modal. Rename it if required. Change Type to NodePort for this tutorial. Click + to add a Port. Expand the Ports-0 service port to make changes. For this tutorial we set the Target Port value to 80. We also set the Port value to 80. Click + next to Selector and add the key value pair app:9870. This is the same pair that is used as label in the Pod. Finally label this service too, with the same key value pair. This also helps in filtering resources specific to us in the Visualize screen. Move your mouse over the service component until you see the green dots on all four sides. Move your mouse over one of the green dots to reveal an arrow, then click the arrow. Select Network option, and then move your mouse to the pod to create the relationship. It should look similar to the screenshot below: Validate the design. Click Validate from the top menu to do so. In order to apply the updated design (which contains a service now), we must undeploy and deploy the design. Select Undeploy and click Undeploy again. To deploy the updated components, select Deploy and click Deploy. To delete the resources such as Pods, use the Undeploy option from the Design view. To recreate, use the Deploy option. Congratulations! You've successfully completed the lab on exploring Kubernetes Pods using Meshery Playground. This hands-on experience should have provided valuable insights into the deployment, management, and interaction with Pods in a Kubernetes environment. Continue exploring more scenarios in the Meshery Playground to enhance your skills.