Centos7 under Kubernetes (2. Kubernetes---Start, important concept)

Source: Internet
Author: User

Cluster

Cluster is a collection of compute, storage, and network resources, and Kubernetes uses these resources to run various container-based applications

Master

Master is the brain of cluster, whose primary responsibility is scheduling, that is, deciding where the application will run. Master runs the Linux operating system, which can be either a physical machine or a virtual machine. To achieve high availability, you can run multiple master.

Node

Node's job is to run the container app. Node has master management, node is responsible for monitoring and reporting the status of the container and managing the lifecycle of the container according to master's requirements. Node runs on the Linux operating system, which can be either a physical machine or a virtual machine.

In the previous interactive tutorial we created Clusyer with only one host host01. It's both master and node.

Pod

The pod is the smallest unit of work for Kubernetes. Each pod contains one or more containers. The container in the pod is scheduled to run as a whole by master on a node

Kubernetes introduced pod mainly based on the following two aspects

1. Manageability

Some containers are meant to be closely connected and work together. Pods provide a higher level of abstraction than containers and encapsulate them in a deployment unit. Kubernetes schedules, expands, shares resources, and manages lifecycle with pod as the smallest unit

2. Communication and resource sharing

All containers in the pod use the same network namespace, which is the same IP address and port space. Communication between them via localhost. Similarly, these containers can share storage, and when kubernet mounts volume to pods, it essentially mounts volume to every container in the pod

Pods two ways to use:

1. Run a single container.

One-container-per-pod is the most common model of kubernetes, in which case it simply encapsulates a single container into pods. Even if there is only one container, Kubernetes manages the pod instead of managing the container directly

2. Running multiple containers

Which containers should be placed in a pod?

The answer is: These containers must be very tightly connected and require direct sharing of resources

As an example:

The following pod consists of two containers: file puller and Web server

File puller periodically pulls the latest files from the external Content manager and stores them in the shared volume. The Web Serverv reads the file from volume and responds to consumer requests.

The two containers are tightly coordinated, together they provide the latest data for consumer, and they share data through volume. So it's appropriate to put it in a pod.

One more example: do you need to put Tomcat and MySQL in a pod?

Tomcat reads data from MySQL, and they need to collaborate, but it doesn't have to be deployed in a pod, started together, and stopped together. They exchange data through JDBC, not directly shared storage, so it's more appropriate to put them in their own pod.

Controller

Kubernetes typically do not create pods directly, but instead use Contorller to manage pods. The controller defines pod deployment features, such as having several copies, running on what node, and so on. To meet different business scenarios, Kubernetes offers a variety of controllers, including Deployment,replicaset,daemonset,statefuleset,job.

Deployment

Is the most commonly used controller, such as in the previous tutorial, by creating deployment to deploy the app. Deployment can manage multiple copies of the pod and ensure that the pod runs in the desired state.

Replicaset

Multi-copy management of Pods is implemented. Replicaset is created automatically when using dployment, which means that deployment manages multiple copies of the pod through Replicaset, and we don't usually need to use Replicaset directly

Daemonset

A scenario that runs at most one pod copy per node. As its name suggests, Daemonset is used for daemon

Statefuleset

To ensure that each copy of the pod has a constant name throughout its lifecycle. Other controllers do not provide this feature, and the pod name changes when a pod fails to be removed and restarted. Colleague Statuefulset will ensure that copies are started, updated, or deleted in a fixed order.

Job

For applications that are deleted at the end of the run, and pods in other controllers are typically long-running states

Service

Defines how the outside world accesses a specific set of pods. The service has its own port and IP. Service provides load balancing for pods

Namespace

A physical cluster can be logically divided into multiple virtual cluster, each cluster a namespace. The resources in different namespace are completely isolated.

Kubernetes two namespace created by default

Default-If you do not specify when creating the resource, it will be placed in the namespace.

Kube-system--kubernetes The system resources created by yourself will be placed in this namespace

Centos7 under Kubernetes (2. Kubernetes---Start, important concept)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.