In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to use kubectl's Deployment to create App. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.
Kubernetes Deployments
The Deployment function of kubectl can instruct Kubernetes how to create and update application instances. After creating a deployment through the kubectl command, Kubernetes master dispatches the deployment-configured application instance to the cluster-specific node to run.
Once the application instances are created, Kubernetes Deployment Controller continues to monitor them. If the node running these instances is downmachine or deleted, Deployment controller replaces it. So Kubernetes provides a self-healing mechanism to handle machine failures or maintenance.
Go to the link below for the deployment application exercise.
Practice environment: https://kubernetes.io/docs/tutorials/kubernetes-basics/deploy-app/deploy-interactive/
The terminal can enter the kubectl get nodes command to view the current cluster
Kubectl run command
The run command creates a new deployment. We need to provide the deployment name and the application image location. If you want to run the application on a specific port, you need to add the-- port parameter:
Kubectl run kubernetes-bootcamp-image=gcr.io/google-samples/kubernetes-bootcamp:v1-port=8080
The above command deploys an application by creating a deployment, and the command does several things:
Search for the appropriate node that can run the application instance (there is currently only one).
The scheduling application runs on this node.
Configure the cluster to reschedule instances on the new node as needed.
Kubectl get deployments this command allows you to view the newly created deployment
View app
Pods that runs inside Kubernetes runs on a private, isolated network. By default, they can be seen from other pod and services within the same kubernetes cluster, but not from outside the cluster network. When we use kubectl, we interact with the application through the API endpoint.
The kubectl command creates a proxy that forwards traffic to a cluster-wide private network. Press control-C to terminate the agent without displaying any output at run time.
Open a second terminal window to run the agent. Kubectl proxy
Now we have established a connection between the host (online terminal) and the Kubernetes cluster. The agent allows direct access to the API from these terminals. You can see all of these api hosted through the proxy endpoint, and the api is now available through http://localhost:8001. For example, we can use the curl command to query the version directly through API: curl http://localhost:8001/version
The API server automatically creates endpoints for each pod based on the pod name, which can also be accessed through the proxy.
First we need to get the Pod name, which we will store in the environment variable POD_NAME: export POD_NAME=$ (kubectl get pods-o go-template-- template'{{range .items}} {{metadata.name}} {{"\ n"}) echo "Name of the Pod: $POD_NAME"
We can now make an HTTP request to the application running in the pod: curl http://localhost:8001/api/v1/namespaces/default/pods/$POD_NAME/proxy/
The result is shown in the figure:
On how to use kubectl's Deployment to create App to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.