{"id":129332,"date":"2022-12-08T10:28:15","date_gmt":"2022-12-08T10:28:15","guid":{"rendered":"https:\/\/ded9.com\/?p=129332"},"modified":"2025-11-22T11:39:28","modified_gmt":"2025-11-22T11:39:28","slug":"how-to-create-and-run-a-microservice-with-kubernetes","status":"publish","type":"post","link":"https:\/\/ded9.com\/tr\/how-to-create-and-run-a-microservice-with-kubernetes\/","title":{"rendered":"How to Create and Run a Microservice With Kubernetes"},"content":{"rendered":"<p><span style=\"font-size: 12pt;\">Developers And Development Teams Can Build Microservices With Kubernetes, Docker, And Jenkins. This development model has a simple process, and you can build and run containers with microservices using the Docker pipeline plugin.\u00a0<\/span><\/p>\n<p>However, the above method has a big flaw; We have to connect all the containers to communicate between the microservices deployed in the containers. Another intelligent solution based on Kubernetes is needed to solve this problem.<\/p>\n<h1><span style=\"font-size: 18pt;\">Getting to know Kubernetes and its essential terms<\/span><\/h1>\n<p><strong>Kubernetes is<\/strong> an open-source platform for automating container deployment, scaling, and operations in host-based clusters. It is a technology that provides an efficient container-oriented infrastructure.<\/p>\n<p>This powerful technology was first developed by Google and gained attention by providing a wide range of application-related features such as load balancing, dependency bundling, high interaction with services, application health monitoring, automatic horizontal scaling, and continuous updates. When you plan to use Kubernetes for microservices, there are a few essential terms you should know about.<\/p>\n<h3>These terms are as follows:<\/h3>\n<p>Pod: A key component of Kubernetes that can consist of one or more containers and ensures that the containers are located on the host machine and share the same resources. Containers in a pod can see other containers through localhost, each with a unique IP address within the cluster.<\/p>\n<p>Service: It is a set of pods that work together. A service is a default placed in a cluster, but can be outside it. In this case, it has an external IP address. Developers can display it using one of the four properties: ClusterIP, NodePort, LoadBalancer, and ExternalName.<\/p>\n<p>Replication Controller: It is a particular type of\u00a0<strong>Kubernetes<\/strong> controller. The above component prepares a certain number of copies of a pod in a cluster so that the replication and scaling process can be done accurately. In addition, the above component is responsible for pod replacement in case of lower-layer node failure.<\/p>\n<p>Minikube: Configuring a Kubernetes cluster that is supposed to be used based on the principle of high availability is not a simple task. Fortunately, there is a tool that makes it simple to run Kubernetes locally.<\/p>\n<p>The device is called Minikube, which can run a single-node cluster in a virtual machine for developers to access whenever needed. If you intend to use the above tool in the Windows operating system, download minikube.exe and kubectl.exe and add them to the PATH environment variable.<\/p>\n<p>Next, you can run it from the command line using the mini kube start command and use all Kubernetes features by calling the Kubernetes order. An alternative to the command line tool, <strong>Kubernetes Dashboard, <\/strong>can be launched by calling the Minikube Dashboard command. In this mode, there is the ability to create, deploy, update, or delete clusters through a dashboard that provides a user interface. Also, configuring all pods, services, inputs, replication controllers, etc., is readily available via the above dashboard. Figure 1 shows the user interface of this tool.<\/p>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter wp-image-129336\" src=\"https:\/\/ded9.com\/wp-content\/uploads\/2022\/12\/word-image-129332-1.jpeg\" alt=\"Next, you can run it from the command line using the mini kube start command and use all Kubernetes features by calling the Kubernetes order. An alternative to the command line tool, Kubernetes Dashboard, can be launched by calling the Minikube Dashboard command. In this mode, there is the ability to create, deploy, update, or delete clusters through a dashboard that provides a user interface. Also, configuring all pods, services, inputs, replication controllers, etc., is readily available via the above dashboard. Figure 1 shows the user interface of this tool.\" width=\"780\" height=\"344\" srcset=\"https:\/\/ded9.com\/wp-content\/uploads\/2022\/12\/word-image-129332-1.jpeg 780w, https:\/\/ded9.com\/wp-content\/uploads\/2022\/12\/word-image-129332-1-300x132.jpeg 300w, https:\/\/ded9.com\/wp-content\/uploads\/2022\/12\/word-image-129332-1-768x339.jpeg 768w\" sizes=\"(max-width: 780px) 100vw, 780px\" \/><\/p>\n<p style=\"text-align: center;\">figure 1<\/p>\n<p><strong>Kubernetes <\/strong>is an excellent tool for clustering and orchestrating microservices. Of course, it is still a relatively new solution under development, but it can be used with the Spring Boot stack or as a replacement for the Spring Cloud Netflix OSS. Providing a dashboard based on the user interface allows you to monitor the resources and how they are accessed accurately.<\/p>\n<p>Are you planning to use microservices? Microservices break an application into small independent parts, yet IT administrators still need a way to manage them.\u00a0With\u00a0<strong>Kubernetes<\/strong>, IT administrators can automatically collect and scale containerized microservices. Specific steps are followed carefully to simplify building and deploying a microservice container in Kubernetes.<\/p>\n<h1><span style=\"font-size: 18pt;\">Advantages of Kubernetes for microservices<\/span><\/h1>\n<p>Containerization, along with its orchestration and management with <strong>Kubernetes<\/strong>, aimed at supporting microservices, is an essential capability that application developers need. This vital feature offers significant benefits, the most important of which are the following:<\/p>\n<ul>\n<li>Self-healing:\u00a0When a container fails or encounters a problem,\u00a0<strong>Kubernetes<\/strong>\u00a0automatically replaces it to maintain application performance and stable conditions.<\/li>\n<li>Declarative configuration management and version control:\u00a0<strong>Kubernetes<\/strong> configurations are stored in YAML format files that allow software version control through Git. Additionally, settings can be updated seamlessly so all containers have the exact locations.<\/li>\n<li>Multi-cloud and hybrid cloud:\u00a0<strong>Kubernetes<\/strong> allows IT teams to choose their preferred cloud platform for deploying workloads.\u00a0Cloud platforms such as Google Cloud Platform, Microsoft Azure, or AWS are available to developers for this purpose.<\/li>\n<li>Service exposure and load balancing: Using domain name systems or IP addresses, <strong>Kubernetes exposes<\/strong> containers in pods or groups of pods so that other microservices can consume those resources.\u00a0Also, IT administrators can load-balance logical pod groups with less hassle.<\/li>\n<li>Secrets Management:\u00a0<strong>Kubernetes<\/strong> plays a vital role in preventing the disclosure of sensitive information, such as passwords and images inside containers, and protects objects that should not be exposed through the etch component.<\/li>\n<li>Scalability:\u00a0When the demand to access services increases or the load increases,\u00a0<strong>Kubernetes<\/strong> horizontally scales the number of containers running a microservice to prevent performance problems.<\/li>\n<li>Zero Downtime:\u00a0<strong>Kubernetes<\/strong> can install additional pods based on a fresh image to ensure no downtime. When new containers are ready, teams can release updates and remove old containers. Additionally, IT teams can roll back changes with minimal downtime if new containers fail.<\/li>\n<\/ul>\n<h1><span style=\"font-size: 18pt;\">Communication between microservices in Kubernetes<\/span><\/h1>\n<p>There are several ways to display a running application in\u00a0<strong>Kubernetes<\/strong>.\u00a0Typically, developers use\u00a0<strong>Kubernetes<\/strong> services to represent an abstract or logical entity of pods on the network. Available services include the following.<\/p>\n<p>Cited:<\/p>\n<ul>\n<li>ClusterIP: Places the service in a cluster with a local<a href=\"https:\/\/ded9.com\/types-of-ip-addresses\/\"> IP address<\/a>. The above service is the default\u00a0<strong>Kubernetes<\/strong> option.<\/li>\n<li>NodePort: Represents the application on a fixed IP and port at the node level so it can be accessed outside the cluster via the IP address and port. This is the method we use in our paper.<\/li>\n<li>LoadBalancer: Defines the application as a service available to a load balancer component hosted on the cloud.<\/li>\n<li>ExternalName: Maps &lt;IPAddress: Port&gt; services to external addresses and names using a CNAME record. In internal communications, you can use the ClusterIP service and the domain name system to configure fully qualified domain names similar to the following addresses:<\/li>\n<\/ul>\n<p>http:\/\/get-employee-microsvc.default.svc.cluster.local<\/p>\n<p>http:\/\/new-employee-microsvc.default.svc.cluster.local<\/p>\n<p>In this case, identification and access from within the cluster are possible. Regardless of the mentioned services, it is possible to use\u00a0<strong>Kubernetes<\/strong>\u00a0Ingress to expose HTTP\/HTTPS services to users, which we will use in this article.<\/p>\n<h1><span style=\"font-size: 18pt;\">Our application<\/span><\/h1>\n<p>The architecture we intend to implement is shown in Figure 2. In <strong>Kubernetes<\/strong>, we have microservices related to User Accounts and Customers. Application services are associated with user account services when searching for customer accounts. Each microservice pod consists of two containers. The first container is connected to the microservice application, and the second is connected to the Mongo database.<\/p>\n<p>Account and customer microservices have their own database where all data is stored. Each pod is available as a service and can be accessed by name in <strong>Kubernetes <\/strong>Searched Here; we&#8217;ll configure Kubernetes Ingress to act as a gateway for microservices.<\/p>\n<p>It is necessary to explain that this program&#8217;s source code is available on the GitHub site, whose address is included at the end of the article.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-129339\" src=\"https:\/\/ded9.com\/wp-content\/uploads\/2022\/12\/word-image-129332-2.jpeg\" alt=\"It is necessary to explain that this program's source code is available on the GitHub site, whose address is included at the end of the article.\" width=\"780\" height=\"536\" srcset=\"https:\/\/ded9.com\/wp-content\/uploads\/2022\/12\/word-image-129332-2.jpeg 780w, https:\/\/ded9.com\/wp-content\/uploads\/2022\/12\/word-image-129332-2-300x206.jpeg 300w, https:\/\/ded9.com\/wp-content\/uploads\/2022\/12\/word-image-129332-2-768x528.jpeg 768w\" sizes=\"(max-width: 780px) 100vw, 780px\" \/><\/p>\n<p style=\"text-align: center;\">figure 2<\/p>\n<p>The above architecture is based on two modules of account service (account service) and customer service (customer service), which operate based on the Spring Boot framework and only use the Feign client component, the Docker account service file. Additionally, we use a small OpenJDK-alpine image. The above image allows our base image to take up only 120MB of space instead of 650MB.<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-java&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">FROM OpenJDK: alpine\r\n\r\nMAINTAINER Piotr Minkowski &lt;piotr.minkowski@gmail.com&gt;\r\n\r\nADD target\/account-service.jar account-service.jar\r\n\r\nENTRYPOINT [\"java,\" \"-jar,\" \"\/account-service.jar\"]\r\n\r\nEXPOSE 2222<\/pre>\n<\/div>\n<p>To enable MongoDB database support, we must add the Spring-boot-Starter-data-MongoDB dependency to pom.xml. Also, we need to define the data access mechanism for application.yml and the @Document class.<br \/>\nNext, we need to extend the repository interface called MongoRepository to be able to perform CRUD operations. For this purpose, we define the required key modules as follows:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-java&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">public interface AccountRepository extends MongoRepository&lt;Account, String&gt; {\r\n\r\npublic Account findByNumber(String number);\r\n\r\npublic List&lt;Account&gt; findByCustomerId(String customerId);\r\n\r\n}<\/pre>\n<\/div>\n<p>In the client service section, we will call the API method from the account service. For this purpose, we need to define @FeignClient so that all pods with the account service can access @FeignClient under the account service and the default service port 2222. The process of determining the above component is as follows:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-java&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">@FeignClient(name = \u201caccount-service\u201d, url = \u201chttp:\/\/account-service:2222\u201d)\r\n\r\npublic interface AccountClient {\r\n\r\n@RequestMapping(method = RequestMethod.GET, value = \u201c\/accounts\/customer\/{customerId}\u201d)\r\n\r\nList&lt;Account&gt; getAccounts(@PathVariable(\u201ccustomerId\u201d) String customerId);\r\n\r\n}<\/pre>\n<\/div>\n<p>In the next step, we use the Docker build command to build the microservice image. Next, we must connect the image to the central Docker hub or our private repository.<\/p>\n<p>To do this, we use the following commands. To view the public Docker Hub repository used in this project, refer to promin\/account-service and promin\/customer-service, whose addresses are at the end of the article.<\/p>\n<p>Docker builds -t promin\/account-service.<\/p>\n<p>docker push promin\/account-service<\/p>\n<h3>Deployment<\/h3>\n<p><strong>You can deploy to Kubernetes<\/strong> using the kubectl run command, the Minikube dashboard, or <a href=\"https:\/\/en.wikipedia.org\/wiki\/YAML\" target=\"_blank\" rel=\"noopener\">YAML<\/a> configuration files with the kubectl create order. One thing to note is that we will make all resources from YAML configuration files since we will deploy multiple containers in a single deployment step.<\/p>\n<p>The deployment configuration file for the user account service is as follows. Note that you must specify the deployment name, the image name, and the port that is supposed to provide access to the service. Also, we need to select the number of requests to build pods in the replicas attribute.<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-java&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">apiVersion: extensions\/v1beta1\r\n\r\nkind: Deployment\r\n\r\nmetadata:\r\n\r\nname: account-service\r\n\r\nLabels:\r\n\r\nrun: account-service\r\n\r\nSpec:\r\n\r\nreplicas: 1\r\n\r\nTemplate:\r\n\r\nMetadata:\r\n\r\nLabels:\r\n\r\nrun: account-service\r\n\r\nSpec:\r\n\r\nContainers:\r\n\r\n- name: account-service\r\n\r\nimage: promin\/account-service\r\n\r\nports:\r\n\r\n- containerPort: 2222\r\n\r\nprotocol: TCP\r\n\r\n- name: mongo\r\n\r\nimage: library\/mongo\r\n\r\nports:\r\n\r\n- containerPort: 27017\r\n\r\nprotocol: TCP<\/pre>\n<\/div>\n<p>Next, we will perform the installation process using the following command. It is possible to use the same power to create services and inputs. The only thing to note is that the YAML file format is different.<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-java&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">kubectl create -f deployment-account. YAML<\/pre>\n<\/div>\n<p>Now, let&#8217;s take a look at the service configuration file. As you can see, the dashboard image is taken from Docker Hub, and the pods and replication set are built based on it. Now, we are going to move our microservice to the production environment.<br \/>\nNext, we need to set the MongoDB database to the default port to connect to the database services and define the collections of MongoDB clients. How to do this is as follows:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-java&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">kind: Service\r\n\r\napiVersion: v1\r\n\r\nmetadata:\r\n\r\nname: account-service\r\n\r\nspec:\r\n\r\nSelector:\r\n\r\nrun: account-service\r\n\r\nports:\r\n\r\n- name: port1\r\n\r\nprotocol: TCP\r\n\r\nport: 2222\r\n\r\ntargetPort: 2222\r\n\r\n- name: port2\r\n\r\nprotocol: TCP\r\n\r\nport: 27017\r\n\r\ntargetPort: 27017\r\n\r\ntype: NodePort<\/pre>\n<\/div>\n<p>Now, we have a service similar to what you see in Figure 3.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-129342\" src=\"https:\/\/ded9.com\/wp-content\/uploads\/2022\/12\/word-image-129332-3.jpeg\" alt=\"Now, we have a service similar to what you see in Figure 3.\" width=\"780\" height=\"293\" srcset=\"https:\/\/ded9.com\/wp-content\/uploads\/2022\/12\/word-image-129332-3.jpeg 780w, https:\/\/ded9.com\/wp-content\/uploads\/2022\/12\/word-image-129332-3-300x113.jpeg 300w, https:\/\/ded9.com\/wp-content\/uploads\/2022\/12\/word-image-129332-3-768x288.jpeg 768w\" sizes=\"(max-width: 780px) 100vw, 780px\" \/><\/p>\n<p style=\"text-align: center;\">Figure 3<\/p>\n<p>After creating a similar configuration for the client service, we must expose our microservices. In <strong>Kubernetes<\/strong>, they are visible through default ports (2222 and 3333) and service names. For this reason, we defined the URL http:\/\/account-service:2222 in the @FeignClient module.<\/p>\n<p>Here, it doesn&#8217;t matter how many pods are created; the service is always available at the defined URL, and requests are balanced between all pods.<\/p>\n<p>If we want to access any service outside of\u00a0<strong>Kubernetes<\/strong> and use software such as web browsers, we must use the container&#8217;s default port number. For example, access to the account service is through port 31638, and customer service is through port 31171.<\/p>\n<p>If you&#8217;re running Minikube on Windows, <strong>Kubernetes<\/strong> is available at 192.168.99.100, so you can interact with the accounts service\u00a0using the URL\u00a0http:\/\/192.168.99.100:31638\/accounts. Of course, before accessing the services, we must define users in the Mongo database and set the application.yml file (Figure 4).<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-129345\" src=\"https:\/\/ded9.com\/wp-content\/uploads\/2022\/12\/word-image-129332-4.jpeg\" alt=\"If you're running Minikube on Windows, Kubernetes is available at 192.168.99.100, so you can interact with the accounts service\u00a0using the URL\u00a0http:\/\/192.168.99.100:31638\/accounts. Of course, before accessing the services, we must define users in the Mongo database and set the application.yml file (Figure 4).\" width=\"780\" height=\"201\" srcset=\"https:\/\/ded9.com\/wp-content\/uploads\/2022\/12\/word-image-129332-4.jpeg 780w, https:\/\/ded9.com\/wp-content\/uploads\/2022\/12\/word-image-129332-4-300x77.jpeg 300w, https:\/\/ded9.com\/wp-content\/uploads\/2022\/12\/word-image-129332-4-768x198.jpeg 768w\" sizes=\"(max-width: 780px) 100vw, 780px\" \/><\/p>\n<p style=\"text-align: center;\">Figure 4<\/p>\n<p>Now, we have two microservices, each with two ports, which is not what we expect. We need a gateway that directs our requests precisely to the desired service by matching the request path. <strong>Kubernetes<\/strong> provides us with a robust capability in this field.<\/p>\n<p>This is the Ingress solution and is available through the Ingress YAML configuration file. Here, we need to define two accounts and customer service policies. Our gateway is available under the hostname micro. All defaults to HTTP port. The following commands show how to configure the settings.<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-java&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">apiVersion: extensions\/v1beta1\r\n\r\nkind: Ingress\r\n\r\nmetadata:\r\n\r\nname: gateway-ingress\r\n\r\nSpec:\r\n\r\nBackend:\r\n\r\nserviceName: default-HTTP-backend\r\n\r\nservice port: 80\r\n\r\nRules:\r\n\r\n- host: micro. all\r\n\r\nHTTP:\r\n\r\nPaths:\r\n\r\n- path: \/account\r\n\r\nbackend:\r\n\r\nserviceName: account-service\r\n\r\nservice port: 2222\r\n\r\n- path: \/customer\r\n\r\nbackend:\r\n\r\nserviceName: customer-service\r\n\r\nservice port: 3333<\/pre>\n<\/div>\n<p>The last thing to make the gateway usable is adding the following entry to the system&#8217;s host file. Go to \/etc\/hosts in Linux and C:\\Windows\\System32\\drivers\\etc\\hosts in Windows and edit the corresponding file. Now, you can access http:\/\/micro.all\/accounts\u00a0or\u00a0http:\/\/micro.all\/customers\/\u00a0{id} from your web browser,\u00a0which calls the account service in the background.<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-java&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">[MINIKUBE_IP] micro. all<\/pre>\n<\/div>\n<h2>FAQ<\/h2>\n<div id=\"rank-math-rich-snippet-wrapper\"><div id=\"rank-math-faq\" class=\"rank-math-block\">\n<div class=\"rank-math-list \">\n<div id=\"faq-1\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">What\u2019s the first step to run a microservice on Kubernetes?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>First, write your microservice (for example with Go, Node.js, or Python), then create a Docker image using a Dockerfile.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-2\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">How do I deploy the microservice to Kubernetes?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Define a Deployment manifest (deployment.yaml) specifying the Docker image and replica count, then apply it with kubectl apply -f deployment.yaml.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-3\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">How can I access my microservice once it's running?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Create a Service in Kubernetes (e.g., ClusterIP, NodePort, or LoadBalancer) to expose your pods; or use kubectl port-forward for local access.<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Developers And Development Teams Can Build Microservices With Kubernetes, Docker, And Jenkins. This development model has a simple process, and you can build and run containers with microservices using the Docker pipeline plugin.\u00a0 However, the above method has a big flaw; We have to connect all the containers to communicate between the microservices deployed in [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":129333,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[96],"tags":[1385],"class_list":["post-129332","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-network","tag-http"],"acf":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/posts\/129332","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/comments?post=129332"}],"version-history":[{"count":5,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/posts\/129332\/revisions"}],"predecessor-version":[{"id":265631,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/posts\/129332\/revisions\/265631"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/media\/129333"}],"wp:attachment":[{"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/media?parent=129332"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/categories?post=129332"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/tags?post=129332"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}