k8s (1): Kubernetes introduction and cluster architecture


1. Understanding container orchestration tools

  • docker machine
    • Mainly used to prepare docker host
    • now deprecated
    • It is recommended to use docker desktop
  • docker compose
    • Compose is a tool for defining and running multi-container Docker applications.
    • With Compose, you use YAML files to configure your application's services.
    • With one command you can create and start all services from your configuration.
  • docker swarm
    • built into docker engine
    • Cluster-level management of the docker engine
  • Distributed design allows more cluster resources and manages more hosts
    • Declarative service model, defining the required state of application services through YAML files
    • The service scale can be expanded or reduced to maintain user expectations
    • service discovery
    • load balancing
    • rolling updates etc.
    • docker service
    • docker stack
  • kubernetes
    • As a container cluster management system, Kubernetes is used to manage container applications on multiple hosts in the container cloud platform. The goal of Kubernetes is to make it easy and efficient to deploy containerized applications. Therefore, Kubernetes provides application deployment, planning, update, A complete set of mechanisms for maintenance.
    • Kubernetes does not have a fixed format for containers, but Kubernetes uses its own API and command-line interface for container orchestration.
    • In addition to Docker containers, Kubernetes also supports a variety of other containers, such as Containerd, rkt, CoreOS, etc.
    • Kubernetes is a self-contained management tool that can implement container scheduling, resource management, service discovery, health check, automatic scaling, update and upgrade, etc. It can also specify the number of replicas in the application template configuration, service requirements (IO priority; performance priority, etc. ), resource usage intervals, labels (Labels, etc.) to match specific requirements to achieve the desired state, etc., these features are enough to conquer developers, plus Kubernetes has a very active community. It provides users with more choices to facilitate users to expand the orchestration container to meet their needs. However, since Kubernetes uses its own API interface, the command system is another system, which is why the application threshold of Kubernetes is relatively high.
  • mesos+marathon
    • Apache Mesos is an open source cluster manager for a distributed system kernel. Apache Mesos appeared much earlier than Docker Swarm and Kubernetes.
    • Combined with Marathon, an orchestration framework for container-based applications, it provides an effective alternative to Docker Swarm and Kubernetes.
    • Mesos can run multiple distributed system types on the same cluster machine, and can share resources more dynamically and efficiently.
    • Messos also provides service failure checking, service publishing, service tracking, service monitoring, resource management and resource sharing.
    • Messos can scale to thousands of nodes.
    • Mesos comes in handy if you have a lot of servers and want to build a large cluster.
    • Many modern and scalable data processing applications can run on Mesos, including big data frameworks Hadoop, Kafka, and Spark.
    • However, being large and comprehensive often means corresponding complexity and difficulty. This is completely correct in Messos. Unlike Docker and Docker Swarm, which use the same API, Mesos and Marathon have their own APIs, which makes them more complex than other orchestrations. The system is more complicated. Apache Mesos is the perfect orchestration tool for mixed environments. Because it includes container and non-container applications, although Messos is very stable, it makes it more difficult for users to quickly learn applications, which is also difficult to promote in application and deployment scenarios one of the reasons.
Distributed resource management framework main feature Remark
Apache Mesos Powerful, but the system is complex and difficult to use 2019 Twitter announced deprecation
Docker Swarm It is integrated in the docker engine and does not need to be installed separately, but has fewer functions Alibaba Cloud announced deprecation in 2019
Google Kubernetes Powerful functions, but high learning and management costs There is currently no substitute, multi-field applications

Two, know kubernetes

2.1 The meaning, origin, and ownership of kubernetes

2.1.1 Meaning

Greek: helmsman, pilot

1557045795562

2.1.2 Origin

  • Derived from Google Borg

  • Developed using golang language

  • Abbreviated as k8s

2.1.3 Attribution

Now owned by CNCF

  • Cloud Native Computing Foundation

  • is an open source software foundation dedicated to making cloud computing ubiquitous and sustainable

  • Official: http://www.cncf.io

image-20220324160124674

2.2 kubernetes version

  • The first official version in September 2014
  • Version 1.0 was officially released in July 2015
  • Now the stable version is 1.24
  • Major Contributors: Google, Redhat, Microsoft, IBM, Intel
  • Code hosting github: https://github.com/kubernetes/

image-20230414122946985

2.3 Kubernetes users

  • In 2017, docker officially announced native support for kubernetes
  • The core of RedHat's PaaS platform OpenShift is kubernetes
  • The core of the Rancher platform is kubernetes
  • At present, most domestic companies can use kubernetes to convert traditional IT services to achieve efficient management.

2.4 Kubernetes URL

  • official website

English site: https://kubernetes.io/

Chinese site: https://kubernetes.io/zh/

image-20230414123250834

  • Chinese community

URL: Kubernetes (K8S) Chinese Documentation_Kubernetes Chinese Community

Three, kubernetes architecture

3.1 Description of software architecture

  • Software Architecture

    • Distributed architecture with central nodes

      • hadoop cluster
      • ceph cluster
    • No central node distributed architecture

      • glusterFS
  • Kubernetes is a distributed architecture with a central node , that is to say, there is a master management node

    • Master Node
      • Central node: manager
      • Simple name: master node
    • Minion Node
      • Work node: worker
      • Simple call point: node node or worker node

3.2 Diagram of Kubernetes Architecture

1557048978763

4. Kubernetes cluster node components

4.1 Master node components

​ The master node is the cluster management center, and its components can run on any node in the cluster, but for the convenience of management, all the components of the Master will be run on one host, and user containers will not be run on this host

Master components include:

  • to apiserver

​ Used to expose the kubernetes API, any resource request/invocation operation is performed through the interface provided by kube-apiserver.

  • kube-controller-manager

​ Controller managers are used to manage controllers, which are background threads that handle routine tasks in the cluster.

  • kube-scheduler

    Monitor newly created Pods that are not assigned to Nodes, and select a Node for the Pods to run.

  • ETCD (a database)

    It is kubernetes that provides the default storage system to save all cluster data.

4.2 Node node component introduction

​ The node node is used to run and maintain Pod, manage volume (CVI) and network (CNI), and maintain information such as pod and service

Node components include:

  • Kubelet
    • Responsible for maintaining the life cycle of containers (creating pods, destroying pods), and also responsible for volume (CVI) and network (CNI) management
  • be a proxy
    • A service (iptables/ipvs) is implemented by maintaining network rules on the host and performing connection forwarding
    • Communicate with apiserver at any time, submit Service or Pod changes to apiserver, save them in etcd (which can be used as a high-availability cluster), and be responsible for service implementation, access from internal pod to service and from external node to service.
  • Container Runtime
    • Container Runtime
    • Responsible for image management and actual running of Pods and containers
    • Support multiple runtimes such as docker/containerd/Rkt/Pouch/Kata

1564397969713

4.3 Introduction of Add-ons

​ Add-ons (accessories) make the functions richer, without which it does not affect the actual use, and can be used in combination with the main program

  • coredns/kube-dns: Responsible for providing DNS services for the entire cluster
  • The Ingress Controller provides access to services outside the cluster
  • Heapster/Metries-server provides cluster resource monitoring (monitoring container can use prometheus)
  • Dashboard provides cluster GUI
  • Federation provides clusters across availability zones
  • Fluentd-elasticsearch provides cluster log collection, storage and query

Guess you like

Origin blog.csdn.net/polaris3012/article/details/130151160