In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Today, the editor will bring you an article about the principle and usage of kubernetes. The editor thinks it is very practical, so I will share it for you as a reference. Let's follow the editor and have a look.
The basic principle kubernetes cooperates each component through the mechanism of watch, and the design of each component is decoupled. The scheduling method nodeName is used to schedule Pod to the specified Node name, and skip the scheduler to directly assign .nodeSelector to schedule Pod to the Node that matches the Label, provided that the node has a tag.
The operator in the upper left corner of the principle diagram creates a nginx resource in the node. API Server and etcd and Scheduler are master.Kubelet and Docker are node nodes. API Server as the only entry accepts the attribute information of the resource created by create to be written to etcd (attribute information: name, image name, constraint), etcd perfect discovery mechanism (watch) to the Scheduler scheduler (see which node is appropriate), and then bind the network information of the relevant pod Feedback to API Server. After receiving the information, api is written to etcd. At this time, etcd stores the network information (IP) of pod. Node1 and kubelet in node1 will manage pod resources and trigger container creation commands. After installation, docker will feedback the status information to API Server. When API Server receives status information and writes it to etcd. API Server is equivalent to the administrator of the platform, responsible for recording the relevant information, etcd is equivalent to the administrator's notepad, the relevant information is written in it, if the API Server is dead, then K8s is basically paralyzed. Sample demonstration-nodeName edits the yaml file vim pod5.yamlapiVersion: v1kind: Podmetadata: name: pod-example labels: app: nginxspec: nodeName: 192.168.142.131 # assigned to the node1 node containers:-name: nginx image: nginx:1.15 # verify that nginx is created to create the yaml file kubectl create-f pod5.yamlkubectl get pods to view detailed events It is found that the pod resource kubectl delete-f. Kubectl get pods sample demo-nodeSelector gets tag help kubectl label-- help needs to get the NAME name on node kubectl get node to set the corresponding node label to kgc=an and kgc=bkubectl label nodes 192.168.142.130 kgc=akubectl label nodes 192.168.142.131 kgc=b view tag kubectl get nodes-show-labelsvim pod5.yamlapiVersion: v1kind: Podmetadata: name: pod-example labels: App: nginxspec: nodeSelector: kgc: B containers:-name: nginx image: nginx:1.15kubectl apply-f pod5.yaml to view detailed events Events allow you to observe kubectl describe pod pod-example troubleshooting assigned by the scheduler to view pod events kubectl describe TYPE NAME_PREFIX view pod log (in Failed state) kubectl logs POD_NAME enters pod (status is running But the service is not provided) kubectl exec-it POD_NAME bash
The above is a summary of the principles and usage of kubernetes, the content is more comprehensive, the editor believes that some of the methods of use may be seen or used in our daily work. I hope you can learn more from this article.
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.