CoreOS

From Bauman National Library
This page was last modified on 7 March 2017, at 13:35.
Revision as of 13:35, 7 March 2017 by egor zorin (Talk | contribs) (External links)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


CoreOS
CoreOS logo
OS family Unix-like
Working state In development
Source model Open source
Initial release October 3, 2013; 8 years ago (2013-10-03)
Latest release 1298.5.0[1] / February 28, 2017; 5 years ago (2017-02-28)
Marketing target Servers and Computer cluster
Platforms x86-64
Kernel type Monolithic (Linux kernel)
License Apache License 2.0
Official website coreos.com

CoreOS - is an operating system with open source software based on Linux to build easily and flexibly scalable clusters. The operating system provides CoreOS only minimal functionality needed to deploy applications within a software container, detection means services and transmission settings. CoreOS has a minimalist distro (136Mb), based on ChromeOS, which in turn is based on Gentoo.

CoreOS can be divided into the following parts:

  • Systemd - manages local services on machines in the cluster
  • Docker - provide insulation services, but its use is, in principle, not necessarily
  • Etcd - distributively stores cluster configuration
  • Fleet - provides distributed services management ( "superstructure" over the systemd)

Overview

CoreOS provides no package manager as a way for distributing payload applications, requiring instead all applications to run inside their containers. Serving as a single control host, a CoreOS instance uses the underlying operating-system-level virtualization features of the Linux kernel to create and configure multiple containers that perform as isolated Linux systems. That way, resource partitioning between containers is performed through multiple isolated userspace instances, instead of using a hypervisor and providing full-fledged virtual machines. This approach relies on the Linux cgroups and namespaces functionalities,

Initially, CoreOS exclusively used Docker as a component providing an additional layer of abstraction and interface.

CoreOS uses ebuild scripts from Gentoo Linux for automated compilation of its system components.

Updates distribution

CoreOS achieves additional security and reliability of its operating system updates by employing FastPatch as a dual-partition scheme for the read-only part of its installation, meaning that the updates are performed as a whole and installed onto a passive secondary boot partition that becomes active upon a reboot or kexec. This approach avoids possible issues arising from updating only certain parts of the operating system, ensures easy rollbacks to a known-to-be-stable version of the operating system, and allows each boot partition to be signed for additional security.

To ensure that only a certain part of the cluster reboots at once when the operating system updates are applied, preserving that way the resources required for running deployed applications, CoreOS provides locksmith as a reboot manager. Using locksmith, it is possible to select between different update strategies that are determined by how the reboots are performed as the last step in applying updates; for example, it may be configured how many cluster members are allowed to reboot simultaneously. Internally, locksmith operates as the daemon that runs on cluster members, while the command-line utility manages configuration parameters.

Cluster infrastructure

CoreOS provides etcd, a daemon that runs across all computers in a cluster and provides a dynamic configuration registry, allowing various configuration data to be easily and reliably shared between the cluster members. Since the key–value data stored within etcd is automatically distributed and replicated with automated master election and consensus establishment using the Raft algorithm, all changes in stored data are reflected across the entire cluster, while the achieved redundancy prevents failures of single cluster members from causing data loss. Beside the configuration management, etcd also provides service discovery by allowing deployed applications to announce themselves and the services they offer. Communication with Mono|etcd is performed through an exposed REST-based API, which internally uses JSON on top of HTTP; the API may be used directly, or indirectly through etcdctl, which is a specialized command-line utility also supplied by CoreOS.

Deployment

When running on dedicated hardware, CoreOS can be either permanently installed to local storage, such as a hard disk drive (HDD) or solid-state drive (SSD), or booted remotely Network booting|over a network using Preboot Execution Environment (PXE) in general, or iPXE as one of its implementations. CoreOS also supports deployments on various hardware virtualization platforms, including Amazon EC2, Ocean, Google Compute Engine, Microsoft Azure, OpenStack, QEMU/KVM, Vagrant and VMware.

CoreOS can also be deployed through its commercial distribution called Tectonic, which additionally integrates Google's Kubernetes as a cluster management utility. As of|2015|04, Tectonic is planned to be offered as beta software to select customers. Furthermore, CoreOS provides Flannel as a component implementing an overlay network required primarily for the integration with Kubernetes.

Installation

CoreOS can set different ways. But for experimental purposes it is easiest through Vagrant:

  1. Install Git, VirtualBox, then Vagrant latest versions.
  2. Go to the folder, rename it user-data.sample file in the user-data, config.rb.sample in config.rb.
  3. Go to discovery.etcd.io/new, copy to clipboard appeared URL, uncomment the line of discovery to the instructions in the user-data and replace it URL.
  4. Go to the folder and there vagrant up.
  5. Wait for the download of the base image.
  6. Do vagrant ssh.

VirtualBox (linux) installation This script based on CoreOS install instruction

#!/bin/bash

USAGE="Usage: $0 -h | [-n name-prefix] [-s size]
This script create cluster of size VBox VMs using default parameters.
Feel free to modify it.
Options:
    -h          This help
    -n          Name prefix for VMs (default: core)
    -s          Size of cluster (default: 3)
CREATEVDI_OPTS will be passed to create-coreos-vdi scripts
This tool creates a CoreOS VDI image to be used with VirtualBox.
"
PREFIX="core"
SIZE=3

: ${CREATEVDI_OPTS:="-V stable"}
while getopts "n:s:h" OPTION
do
    case $OPTION in
        n) PREFIX="$OPTARG" ;;
        s) SIZE=$OPTARG ;;
        h) echo "$USAGE"; exit;;
        *) exit 1;;
    esac
done

#Disk image downloading
: ${IMAGE:=coreos_prod.vdi}
echo $IMAGE
if  [ ! -f $IMAGE ]
then
	if [ ! -f "create-coreos-vdi" ]
	then
		wget https://raw.githubusercontent.com/coreos/scripts/master/contrib/create-coreos-vdi
		chmod +x create-coreos-vdi
	fi
	source ./create-coreos-vdi $CREATEVDI_OPTS
  mv $VDI_IMAGE $IMAGE
fi

#token generation
TOKEN=$(curl http://discovery.etcd.io/new?size=$SIZE | sed 's|.*/||')

#cloud-config template
CLOUD_CONFIG='#cloud-config
users:
  - name: "user"
    passwd: "$1$53YHkhSo$bvjpI.GPhDuC8pUfqAlrT."
    groups:
      - "sudo"
      - "docker"
    ssh-authorized-keys:
      - "<SSH_KEY>"
ssh_authorized_keys:
  - <SSH_KEY>
hostname: <HOSTNAME>
coreos:
  etcd2:
    advertise-client-urls: http://<IP>:2379,http://<IP>:4001
    initial-advertise-peer-urls: http://<IP>:2380
    discovery: https://discovery.etcd.io/<TOKEN>
    listen-peer-urls: http://<IP>:2380,http://<IP>:7001
    listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
  units:
    - name: etcd2.service
      command: start
    - name: fleet.service
      command: start

    - name: static.network
      runtime: true
      content: |
        [Match]
        Name=enp0s3

        [Network]
        DNS=192.168.15.1
        Address=<IP>/24
        Gateway=192.168.15.1
#'
#adding SSH keys
while read l; do
    if [ -z "$SSH_KEY" ]; then
        SSH_KEY="$l"
    else
        SSH_KEY="$SSH_KEY
  - $l"
    fi
done < ~/.ssh/id_rsa.pub

#filling config
CLOUD_CONFIG="${CLOUD_CONFIG//<SSH_KEY>/${SSH_KEY}}"
CLOUD_CONFIG="${CLOUD_CONFIG//<TOKEN>/${TOKEN}}"

#configuring cluster NAT-network
VBoxManage natnetwork remove --netname ${PREFIX}_net
VBoxManage natnetwork add --netname ${PREFIX}_net --network "192.168.15.0/24" --dhcp off --enable

#VM creation
for i in $(seq 1 $SIZE)
do

	NAME=$PREFIX$i
	CLOUD_CONFIG_x=$CLOUD_CONFIG
	public_ipv4="192.168.15.$((100+$i))"

  #filling config
	CLOUD_CONFIG_x="${CLOUD_CONFIG_x//<HOSTNAME>/${NAME}}"
	CLOUD_CONFIG_x="${CLOUD_CONFIG_x//<IP>/${public_ipv4}}"

	WORKDIR="tmp.${RANDOM}"
	mkdir "$WORKDIR"

	CONFIG_DIR="${WORKDIR}/openstack/latest"
	CONFIG_FILE="${CONFIG_DIR}/user_data"
	CONFIGDRIVE_FILE="$NAME.iso"

	mkdir -p "$CONFIG_DIR"
	touch ${CONFIG_FILE}
	cat > ${CONFIG_FILE} << EOL
${CLOUD_CONFIG_x}
EOL

  #config-drive creation
	mkisofs -R -V config-2 -o "$CONFIGDRIVE_FILE" "$WORKDIR"
	rm -rf $WORKDIR

  #clonning VDI
	 VBoxManage clonehd $IMAGE $NAME.vdi
	 VBoxManage modifyhd $NAME.vdi --resize 10240

  #VM configuring
	VBoxManage createvm --name $NAME --ostype Linux26_64 --register
	VBoxManage modifyvm $NAME --memory 1024
  #network configuration
  VBoxManage modifyvm $NAME --nic1 natnetwork
	VBoxManage modifyvm $NAME --nat-network1 ${PREFIX}_net
	VBoxManage natnetwork modify --netname ${PREFIX}_net --port-forward-4 "ssh_$NAME:tcp:[]:$((1022+$i)):[$public_ipv4]:22"
  VBoxManage modifyvm $NAME --nic2 nat
  #port-forwarding
  VBoxManage modifyvm $NAME --natpf2 "ssh_$NAME,tcp,127.0.0.1,$((2200+$i)),,22"
  #attaching VDI
  VBoxManage storagectl $NAME --name "SATA Controller" --add sata --controller IntelAHCI
	VBoxManage storageattach  $NAME --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium  $NAME.vdi
  #attaching config-drive
  VBoxManage storagectl  $NAME --name "IDE Controller" --add ide
	VBoxManage storageattach $NAME  --storagectl "IDE Controller" --port 0 --device 0 --type dvddrive --medium $NAME.iso
done

See also

  • Application virtualization software technology that encapsulates application software from the operating system on which it is executed
  • Comparison of application virtualization softwarevarious portable and scripting language virtual machines
  • Comparison of platform virtualization software snd various emulators and hypervisors, which emulate the whole physical computers
  • LXC (Linux Containers)an environment for running multiple isolated Linux systems (containers) on a single Linux control host
  • Operating-system-level virtualization implementations based on operating system kernel's support for multiple isolated userspace instances
  • Software as a service a software licensing and delivery model that hosts the software centrally and licenses it on a subscription basis
  • Virtualizationa general concept of providing virtual versions of computer hardware platforms, operating systems, storage devices, etc.

References

Cite error: Invalid <references> tag; parameter "group" is allowed only.

Use <references />, or <references group="..." />

External links

  • "CoreOS Release Notes".