In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
In this issue, the editor will bring you basic knowledge about how to understand kubernetes. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
Basic introduction to kubernetes
What is kubernetes?
Kubernetes is an open source container management platform, referred to as k8s, which is used to manage containerized applications on multiple hosts, providing rapid deployment, expansion, upgrade, maintenance and expansion of applications. Service can be used to achieve service registration, discovery and four-layer load balancing, and seven-layer load balancing can be achieved through ingress. The name Kubernetes comes from Greek, meaning helmsman or pilot. Google opened the Kubernetes project in 2014. Kubernetes is based on Google's 15 years of experience in running a large production workload and combines the best ideas and practices in the community. The community is extremely active and has a large number of technicians to maintain and support behind the scenes.
II. Advantages of kubernetes container orchestration tools
1. The effect of user experience is good, and you can get started quickly:
With a good web ui interface, you can achieve rapid deployment, upgrade, expansion, reduction, rollback and so on.
two。 Schedule pod reasonably according to the usage of node resources:
You can schedule pod according to your needs, such as ensuring that Pod runs only on nodes with sufficient resources, trying to distribute the pod of the same function on different nodes, and trying to balance the resource utilization of different nodes.
3. Flexible deployment:
Supports a variety of platforms, such as public cloud, private cloud, hybrid cloud, VMware vSphere, VMware Workstation, virtual machines, physical machines, etc.
4. Perfect authentication and authorization mechanism, with its own audit function:
Multiple users can do detailed authorization management, so that the operation between each other is completely isolated and does not affect each other, and it has its own audit function, which can log the operation process in real time, and it is convenient to troubleshoot problems.
5. Highly scalable:
With strong cluster expansion ability, it can automatically increase and reduce the number of host nodes according to the business scale, ensure that the service can withstand the pressure brought by a large number of concurrency, and ensure the stable operation of the business.
6. Have a comprehensive disaster preparedness early warning solution:
It has a variety of disaster recovery solutions, supports backup and disaster recovery, and can be switched in seconds in the event of failure to ensure that online business will not be affected.
7. Windows nodes are supported:
Kubernetes supports adding windows nodes as work nodes and deploying windows containers to ensure that they are no longer affected by specific operating system types and improve the efficiency of the overall deployment.
Third, the practice of application scenarios
Application of 1.kubernetes in Log Management system
In a production environment, logs are very important for troubleshooting. We need a log management system, such as efk,kubernetes, to achieve rapid deployment of efk. We can collect logs from nodes and k8s clusters by deploying fluentd components using daemonset controller. Deploying efk log management system through kubernetes can achieve the following functions:
(1) if the cluster capacity is expanded, the daemonset controller will automatically detect the new node nodes and deploy fluentd on the new node nodes to complete log collection, which can reduce human intervention, improve work efficiency, and ensure that logs can be collected normally; (2) if the amount of es data is large, kubernetes can achieve horizontal expansion of pod applications in the cluster, and complete flexible expansion and contraction of applications.
Application of 2.kubernetes in DevOps scenarios:
DevOps is a complete set of operation and maintenance development process, which can quickly build, test and release software. The whole process includes agile development-> continuous integration-> continuous delivery-> continuous deployment-> DevOps. Through Kubernetes, we can achieve unified scheduling of containers on multiple computing nodes, connect containers to persistent storage, virtual networks, and achieve elastic scaling, thus improving the iterative speed of the product. Adding k8s in the DevOps system can achieve the following functions:
(1) Multi-cluster management: multiple kubernetes clusters can be deployed to the development, test and production environment according to customer requirements. Each environment uses independent physical resources to avoid mutual influence. (2) Multi-environment consistency: Kubernetes is a container orchestration tool based on docker. Because the image of the container is immutable, the image includes OS, business code, running environment, library and directory structure. The image is stored in our private repository. As long as the user pulls the image from the private repository provided by us, the consistency of the environment can be ensured. (3) continuous integration, continuous deployment, continuous delivery: the product can be iterated quickly, deployed automatically, and the ability of continuous delivery can be achieved according to customer requirements.
Application of 3.kubernetes in Micro Services
Service Mesh can ensure the interworking and unified governance between unsplit applications and split micro-services. It does not bind business code to any framework, platform or services. When managing micro-services, we need to register these micro-services and their invocation relationships, allocate resources to them, create a certain number of node copies, and publish them to the cluster. At the same time, we also need to configure the network and load balancing so that these micro-services can be accessed externally. During the operation of these micro-services, we need to maintain their availability all the time. If there is a problem with the node, we need to create a new node to replace it immediately. During the operation, these micro-services need to be monitored and log collected. When the load changes, you should also be able to quickly adjust the resource allocation. Kubernetes can achieve the following functions in micro-services:
(1) Service discovery: service discovery, load balancing, self-repair and automatic association can be realized through service; (2) provide a unified configuration management center: for the configuration center, K8S provides configMap, which can inject configuration into environment variables or Volume when the container starts; (3) Auto scaling: create a specified number of pod copies through the controller, and horizontal expansion and recovery of pod applications can be realized through hpa. (4) continuous integration / continuous deployment through jenkins. (5) automatic expansion: when the serious shortage of resources in the Kubernetes cluster leads to Job queuing, it is easy to add a Kubernetes Node to the cluster to achieve expansion.
IV. Characteristics of kubernetes
1. Portable:
Support for public, private, hybrid, and multiple clouds (multi-cloud)
two。 Scalable:
Modular, plug-in, mountable, combinable
3. Self-healing:
Automatic layout, automatic restart, automatic replication, automatic expansion.
5. Detailed introduction of kubernetes functions
1. Network isolation for multi-tenancy:
Kubernetes supports a variety of network plug-ins, such as flannel,calico,canel, etc. Each plug-in has unique performance and can be applied to a variety of scenarios. We can use calico's network policy (network policy) to solve network isolation in k8s. For multi-tenant scenarios, each user can have a namespace, and then set network isolation to this namespace.
two。 High availability:
Kubernetes supports a variety of highly available solutions, such as keepalive+nginx,keepalived+haproxy, which can distribute access traffic to different host nodes and reduce the pressure on the node. if a node fails, it can achieve wonderful switching to achieve high availability and ensure that the business will not be interrupted.
3. Persistent storage of user data:
Kubernetes supports a variety of persistent storage solutions to ensure that data can be well backed up and reduce the risk of user data loss. The storage solutions available in kubernetes are as follows:
(1) Local Storage emptyDir,hostPath (2) Network connected Storage SAN/ Network attached Storage: iSCSINAS/ Storage Local area Network: nfs,cifs (3) distributed Storage glusterfs,ceph/ Block level Storage, cephfs/ File system level Storage (4) Cloud Storage: Azure Disk, etc.
4. Have multiple update rollback strategies
By managing the controller and service of kubernetes, you can achieve grayscale release, blue-green deployment, canary release, fast business and rollback operations to meet the different upgrade needs of different customers.
5. Elastic expansion
According to the traffic pressure of access, the horizontal expansion and reduction of pod can be achieved, and the capacity can be expanded in seconds, so that the pod can always meet the number required for normal business operation, thus avoiding the waste of resources.
6. Kubernetes can meet the needs of many applications in running environments, as follows:
Process collaboration, using composite applications to ensure that applications and containers are one-to-one model storage system mount distribution key application health detection application instance replication level automatic extension naming and discovery load balancing rolling update resource monitoring log access self-test and debugging identification and authentication which provides PaaS with the convenience of the IaaS layer and portability between infrastructure providers.
VI. Kubernetes architecture
The physical architecture of kubernetes is master/node mode, and master generally has three or five nodes to make high availability. Depending on the size of the cluster, master high availability means to make apiserver highly available or master physical nodes to be highly available. Node can have multiple nodes specifically used to deploy applications. The architecture figure is as follows:
VII. Core components of kubernetes
1.master Node component
Apiserver: provides a unique entry for resource operation, and provides mechanisms such as authentication, authorization, access control, API registration and discovery, which are responsible for receiving, parsing and processing requests.
Scheduler: a scheduler responsible for scheduling resources and dispatching Pod to the corresponding machine according to a predetermined scheduling policy.
Kube-controller-manager: controller, responsible for maintaining the state of the cluster and checking the health of the pod, such as fault detection, automatic extension, rolling updates, and so on.
Docker: is a container engine for running containers.
Etcd:etcd is a key-value storage in the form of key/value, which stores the state of the entire kubernetes cluster. When using etcd in kubernetes, you need to back up the etcd to ensure high availability. There are two services in the kubernetes system that need to be used for collaboration and storage configuration, namely:
(1) Network plug-in calico. For other network plug-ins, etcd is also required to store network configuration information.
(2) kubernetes itself, including the status and meta-information configuration of various objects.
Note: notes on the version of etcd API
The network plug-in operates etcd using v2 API, while kubernetes operates v3 API used by etcd, so we need to set the ETCDCTL_API environment variable when we execute etcdctl below. The default value of this variable is 2, which means using v2 version of api,v3 means using v3 version of api.
2.node node (worker node) component
Kubelet: responsible for communicating with the apiserver of the master node, receiving customer requests, creating Pod, managing Pod, starting pod and other related operations.
Kube-proxy:k8s agent is a network agent that runs on each node in the cluster. Kube-proxy is responsible for forwarding requests. Once a change in Pod information associated with a Service is found (such as IP, Port, etc.), Kube-Proxy will convert the changed service into IPVS or IPtables rules to complete the load balancing of the back-end pod.
Docker: is a container engine for running containers.
3. Additional component
Coredns:k8s1.11 used to use kubedns,1.11 before coredns,coredns is a DNS server that can provide DNS records for Kubernetes services
Dashboard:k8s 's web interface, through which you can manipulate K8s resources
Ingress Controller: a seven-tier load balancer controller, which can create a seven-tier load application such as nginx or traefik to achieve domain name and https access
Prometheus+alertmanager+grafana: monitoring component
Efk: log collection component
The above is the basic knowledge of how to understand kubernetes shared by the editor. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
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.