Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the way for Kubernetes to extend the application?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article focuses on "what is the way to extend Kubernetes applications". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what is the method of extending Kubernetes applications?"

Extend an application

In the previous tutorial, we created a deployment and then exposed the application in the form of a service. The deployment creates only one Pod for running the application. As traffic increases, we need to extend the application to meet the needs of users.

Scalability is achieved by changing the number of copies in the deployment.

The scale-out deployment ensures that a new Pods is created and dispatched to a node with available resources. Zooming will increase the number of Pods to the new desired state. Kubernetes also supports automatic scaling of Pods, but this is beyond the scope of this tutorial. You can also zoom to zero, and then it will terminate all Pods for a particular deployment.

Running multiple instances of an application will require a way to distribute traffic to all instances. The service has an integrated load balancer that distributes network traffic to all publicly deployed Pods. The service uses endpoints to continuously monitor running Pods to ensure that traffic is sent only to available Pods.

Once the application has run multiple instances, it can be scrolled and updated without downtime.

To list the deployment, use the get deployments command: kubectl get deployments, and you can see the status of the deployment.

Use the kubectl scale command to expand the deployment to four replicas: kubectl scale deployments/kubernetes-bootcamp-- replicas=4. Check the deployments status again after the expansion, and you can see the expansion.

After applying the changes, there will be four application instances available. Looking at the number of pod: kubectl get pods-o wide, you can see that there are four Pods with different IP addresses. The changes are registered in the deployment event log. You can view it through the describe command: kubectl describe deployments/kubernetes-bootcamp

Let's check whether the service is load balancing traffic. To find the exposed IP and port, we can use the describe service command: kubectl describe services/kubernetes-bootcamp

Create an environment variable named NODE_PORT with the node port as the value: export NODE_PORT=$ (kubectl get services/kubernetes-bootcamp-o go-template=' {{(index .spec.ports 0) .nodePort}}'); "echo NODE_PORT=$NODE_PORT"

Curl $(minikube ip): $NODE_PORT this command can be executed multiple times to view different returned results

At this point, I believe that you have a deeper understanding of "what is the way to extend Kubernetes applications?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report