A must-read for getting started with K8s & kubernetes introduction and cluster architecture

Introduction to Kubernetes 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.
    • Using Compose, you can use YAML files to configure your application's services.
    • Using a single command you can create and start all services from your configuration.
  • docker swarm
    • Built into docker engine
    • Cluster-level management of docker engines
  • Distributed design allows the cluster to have more resources and manage more hosts
    • Declarative service model that defines 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 the deployment of containerized applications simple and efficient, so Kubernetes provides application deployment, planning, and updates. A complete set of maintenance mechanisms.
    • Kubernetes does not require a fixed container format, 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. You can also specify the number of copies, service requirements (IO priority; performance priority, etc.) in the application template configuration ), resource usage intervals, labels (Labels, etc.) to match specific requirements to achieve expected states, etc. These features are enough to conquer developers, plus Kubernetes has a very active community. It provides users with more options to extend 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 distributed system kernels. 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 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 scalable data processing applications can run on Mesos, including big data frameworks Hadoop, Kafka, and Spark.
    • But being large and comprehensive often results in corresponding complexity and difficulty. This is completely true when it comes to Messos. Unlike Docker and Docker Swarm, which use the same API, Mesos and Marathon have their own APIs, which makes them better than other orchestrators. The system is more complex. 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 Twitter announces deprecation in 2019
Docker Swarm Integrated in the docker engine, does not require separate installation, but has fewer functions Alibaba Cloud announced its deprecation in 2019
Google Kubernetes Powerful functions, but high learning and management costs There is currently no substitute, and it can be used in many fields.

2. Understanding kubernetes

2.1 kubernetes meaning, origin and attribution

2.1.1 Meaning

Greek: helmsman, pilot

Insert image description here

2.1.2 Origin

  • From Google Borg

  • Developed using golang language

  • Referred to as k8s

2.1.3 Attribution

Now belongs to CNCF

  • Cloud Native Computing Foundation

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

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

Insert image description here

2.2 kubernetes version

  • The first official version in September 2014
  • Version 1.0 was officially released in July 2015
  • The stable version is now 1.23
  • Main contributors: Google, Redhat, Microsoft, IBM, Intel
  • Code hosting github: https://github.com/kubernetes/

Insert image description here

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 Rancher platform is kubernetes
  • Nowadays, most domestic companies can use kubernetes to convert traditional IT services to achieve efficient management.

2.4 Kubernetes URL

  • official website

https://kubernetes.io/

Insert image description here

https://kubernetes.io/zh/

Insert image description here

  • Chinese community

Insert image description here

3. kubernetes architecture

3.1 Software architecture description

  • Distributed architecture with central node

    • hadoop cluster
    • ceph cluster
  • Distributed architecture without central node

    • glusterFS
  • Kubernetes is a distributed architecture with a central node, which means there is a master management node

    • Master Node
      • central node
      • manager
      • Simple name
        • master node
    • Minion Node
      • Work node
      • worker
      • Simply call
        • nodenode
        • worker node

3.2 Kubernetes architecture diagram

Insert image description here

Insert image description here

4. Kubernetes cluster node components

4.1 Master node component

The master node is the cluster management center. Its components can be run on any node in the cluster. However, for the convenience of management, all 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 kubernetes API. Any resource request/call operation is performed through the interface provided by kube-apiserver.

  • kube-controller-manager

​Controller managers are used to manage controllers. They are background threads that handle regular tasks in the cluster.

  • kube-scheduler

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

  • ETCD

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

4.2 Introduction to Node node components

Node nodes are used to run and maintain Pods, manage volumes (CVI) and networks (CNI), and maintain pod and service information.

Node components include:

  • kubelet
    • Responsible for maintaining the life cycle of the container (creating pods, destroying pods), and also responsible for the management of Volume (CVI) and network (CNI)
  • be a proxy
    • Implement service (iptables/ipvs) 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 (can be used as a high-availability cluster), be responsible for service implementation, and access from internal pod to service and from external node to service.
  • Container Runtime
    • Container Runtime
    • Responsible for image management and the actual operation of Pods and containers
    • Supports multiple runtimes such as docker/containerd/Rkt/Pouch/Kata

Insert image description here

4.3 Introduction to Add-ons

Add-ons (accessories) make the functions richer. The absence of them does not affect the actual use and can be used in conjunction with the main program.

  • coredns/kube-dns: Responsible for providing DNS services for the entire cluster
  • Ingress Controller provides services with external access to the cluster
  • Heapster/Metries-server provides cluster resource monitoring (prometheus can be used for monitoring containers)
  • 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/weixin_47758895/article/details/130566564