CoreOS practice: Introduction to CoreOS and management tools
[Editor's note] CoreOS is a Docker-based lightweight containerized Linux release designed for large data centers, it aims to simplify the maintenance cost and complexity of the data center through lightweight system architecture and flexible application deployment capabilities. CoreOS, as an important member of the Docker ecosystem, has received increasing attention from major cloud service providers. At present, it has completed A round of financing and is gaining momentum. InfoQ hopes that the series of articles in CoreOS practice will help readers understand CoreOS and related usage methods. If Docker is the next generation of virtual machines, CoreOS should be the next generation of Server Linux. InfoQ is willing to explore this new thing with you.
1. Overview
With the popularity of Docker, CoreOS, as a Docker-based lightweight containerized Linux release, has received increasing attention. Currently, all mainstream cloud service providers provide support for CoreOS. CoreOS is a Linux release in the new era. What are its unique charms? As the first part of CoreOS practice, this article will briefly introduce CoreOS and CoreOS related management tools, and try to unveil the secret behind CoreOS.
2. Zen of CoreOS
Docker, a cloud computing star, is developing at a rocket speed, and the ecosystem related to it is getting better. CoreOS is one of them. CoreOS is A brand new Linux operating system designed for data centers. In July 2014, CoreOS released its first stable version, which has completed A round financing of $8 million. CoreOS is designed specifically for large data centers. It aims to simplify the maintenance cost and complexity of data centers with lightweight system architecture and flexible application deployment capabilities. Now CoreOS has launched a paid product. With payment, you can use visualization tools to manage your CoreOS clusters.
Compared with other Linux operating systems that have a long history and are widely used, CoreOS has the following advantages.
First, CoreOS does not provide a package management tool, but provides computing resources to applications through the containerized computing environment. Applications share system kernels and resources, but they are invisible to each other. This means that the application will not be directly installed in the operating system, but will run in the container through Docker. This method greatly reduces the Coupling Degree between the operating system, application, and operating environment. Compared with the traditional deployment method, it is more flexible and convenient to deploy applications in the CoreOS cluster, with less interference between application running environments, and easier to maintain the operating system.
Secondly, CoreOS adopts dual root partition design. The two partitions are set to active and passive modes respectively, and perform their respective duties during system operation. Active partitions are responsible for system operation, and passive partitions are responsible for system upgrade. Once a new version of the operating system is released, a complete system file will be downloaded to a passive partition and started from the new partition when the system is restarted next time, the original passive partition will be switched to the active partition, while the previous active partition will be switched to the passive partition, and the roles played by the two partitions will be opposite each other. At the same time, the system partition is set to read-only during system operation, which ensures the security of CoreOS. The upgrade process of CoreOS is automatically completed by default, and the network and disk resources used during the upgrade are restricted through cgroup, minimizing the impact of system upgrade.
In addition, CoreOS uses Systemd to replace SysV as a management tool for systems and services. Compared with SysV, Systemd not only can better track system processes, but also has excellent parallel processing capabilities, coupled with On-Demand startup and other features, and combined with Docker's fast start capability, deploying Docker Containers in a large scale in the CoreOS cluster has more obvious performance advantages than using other operating systems. Another feature of Systemd is the introduction of the "target" concept. Each target is applied to a specific service and can be extended by inheriting an existing target, this gives the operating system better control over the services running on the system.
By re-designing the system structure, CoreOS removes any unnecessary software and services. To some extent, it reduces the complexity of maintaining a server cluster and helps users free from tedious system and software maintenance work. Although CoreOS was originally originated from Google ChromeOS, from the very beginning, CoreOS was more suitable for a cluster environment than a traditional server operating system.
3. CoreOS related tools
In addition to the operating system, the CoreOS team and other teams also provide several tools to help users manage CoreOS clusters and deploy Docker containers.
3.1. etcd
Etcd is the skeleton in the CoreOS cluster. Etcd is a Distributed key/value storage service. Programs and Services in the CoreOS cluster can be found through etcd sharing information or service discovery. Based on the well-known raft consistency algorithm, etcd synchronizes data by selecting Lead in the server in the form of election, and ensures that the information in the cluster is always consistent and available. Etcd is installed in each CoreOS system by default. In the default configuration, etcd uses two ports in the system: 4001 and 7001, of which 4001 is provided to external applications to read and write data in the form of HTTP + Json, and 7001 is used for data synchronization between each etcd. You can configure CA Cert to enable etcd to read and write data and synchronize data in HTTPS mode to further ensure the security of data information.
3.2. fleet
Fleet is a tool that uses Systemd to control and manage CoreOS clusters. Fleet interacts with Systemd through the D-Bus API, and each fleet agent registers and synchronizes data through the etcd service. Fleet provides a wide range of functions, including viewing the server status in the cluster, starting or terminating Docker container, and reading log Content. More importantly, fleet ensures that the services in the cluster are always available. When a service created through fleet is unavailable in the cluster, if a host is detached from the cluster due to hardware or network faults, A series of services originally running on this server will be reassigned to other available servers through fleet. Although fleet is still in a very early state, its ability to manage CoreOS clusters is very effective and there is still a lot of room for expansion, simple API interfaces are provided for user integration.
3.3. Kubernetes
Kuberenetes is a Docker containers management tool for clusters open-source by Google. You can deploy a group of ininers in the form of "POD" to the cluster through Kubernetes. Unlike fleet, which focuses more on CoreOS cluster management, Kubernetes is a Containers management tool. Kubernetes manages a series of interconnected Containers in the unit of "POD". These Containers are deployed on the same physical host, have the same network address and share the storage quota.
3.4. flannel (rudder)
Flannel (rudder) is an overlay network designed by the CoreOS team for Kubernetes. It aims to help each CoreOS host using Kuberentes have a complete subnet. Kubernetes allocates an independent IP address for each POD, so that the Containers in the same POD can be connected to each other. The existing CoreOS does not have this capability. To solve this problem, flannel sets a subnet for the host by creating an overlay mesh network in the cluster.
4. Next Introduction
In the next article, I will show you how to create a CoreOS cluster and manage Docker Containers through Kubernetes.
How to deploy a WordPress instance in CoreOS
Initial server operating system CoreOS experience
CoreOS details: click here
CoreOS: click here
This article permanently updates the link address: