mirror of
https://github.com/rancher/os.git
synced 2025-09-01 06:40:31 +00:00
Early cloud-init
This commit is contained in:
@@ -81,7 +81,6 @@
|
||||
<li><a href="{{site.baseurl}}/os/configuration/setting-up-docker-tls/">Setting up Docker TLS</a></li>
|
||||
<li><a href="{{site.baseurl}}/os/configuration/private-registries/">Private Registries</a></li>
|
||||
<li><a href="{{site.baseurl}}/os/configuration/switching-docker-versions/">Switching Docker Versions</a></li>
|
||||
<li><a href="{{site.baseurl}}/os/configuration/prepacking-docker-images/">Pre-packing Docker Images</a></li>
|
||||
<li><a href="{{site.baseurl}}/os/configuration/users/">Users</a></li>
|
||||
<li><a href="{{site.baseurl}}/os/configuration/resizing-device-partition/">Resizing a Device Partition</a></li>
|
||||
<li><a href="{{site.baseurl}}/os/configuration/sysctl/">sysctl Settings</a></li>
|
||||
@@ -96,10 +95,17 @@
|
||||
<a href="#systemservices" data-toggle="collapse" class="collapsed" data-parent="#mainmenu">System Services<i class="pull-right fa fa-angle-down"></i><i class="pull-right fa fa-angle-up"></i></a>
|
||||
<ul class="collapse list-group-submenu" id="systemservices">
|
||||
<li><a href="{{site.baseurl}}/os/system-services/adding-system-services/">System Services</a></li>
|
||||
<li><a href="{{site.baseurl}}/os/system-services/built-in-system-services/">Built-in System Services</a></li>
|
||||
<li><a href="{{site.baseurl}}/os/system-services/system-docker-volumes/">System Docker Volumes</a></li>
|
||||
<li><a href="{{site.baseurl}}/os/system-services/environment/">Environment</a></li>
|
||||
</ul>
|
||||
<li class="panel">
|
||||
<a href="#bootprocess" data-toggle="collapse" class="collapsed" data-parent="#mainmenu">Boot Process<i class="pull-right fa fa-angle-down"></i><i class="pull-right fa fa-angle-up"></i></a>
|
||||
<ul class="collapse list-group-submenu" id="bootprocess">
|
||||
<li><a href="{{site.baseurl}}/os/boot-process/built-in-system-services/">Built-in System Services</a></li>
|
||||
<li><a href="{{site.baseurl}}/os/boot-process/cloud-init">Cloud-init</a></li>
|
||||
<li><a href="{{site.baseurl}}/os/boot-process/image-preloading">Image Preloading</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</li>
|
||||
<li class="panel">
|
||||
<a href="#storage" data-toggle="collapse" class="collapsed" data-parent="#mainmenu">Storage<i class="pull-right fa fa-angle-down"></i><i class="pull-right fa fa-angle-up"></i></a>
|
||||
|
@@ -1,54 +1,19 @@
|
||||
---
|
||||
title: Built-in System Services in RancherOS
|
||||
layout: os-default
|
||||
|
||||
redirect_from:
|
||||
- os/system-services/built-in-system-services/
|
||||
---
|
||||
|
||||
## Built-in System Services
|
||||
|
||||
To launch RancherOS, we have built-in system services. They are defined in the [Docker Compose](https://docs.docker.com/compose/compose-file/) format, and can be found in the default system config file, `/usr/share/ros/os-config.yml`. You can [add your own system services]({{site.baseurl}}/os/system-services/) or override services in the cloud-config.
|
||||
|
||||
In start up order, here are the groups of services:
|
||||
### preload-user-images
|
||||
|
||||
1. Device and power management:
|
||||
- udev-cold
|
||||
- udev
|
||||
- acpid
|
||||
Read more about [image preloading]({{site.baseurl}}/os/boot-process/image-preloading/).
|
||||
|
||||
2. syslog
|
||||
|
||||
3. System configuration and networking:
|
||||
- preload-system-images
|
||||
- cloud-init-pre
|
||||
- network-pre
|
||||
- ntp
|
||||
- cloud-init
|
||||
- network
|
||||
|
||||
4. User interaction:
|
||||
- console
|
||||
- docker
|
||||
|
||||
5. Post configuration:
|
||||
- preload-user-images
|
||||
|
||||
### preload-system-images & preload-user-images
|
||||
|
||||
Read more about [pre-packing Docker images]({{site.baseurl}}/os/configuration/prepacking-docker-images/).
|
||||
|
||||
### cloud-init-pre
|
||||
|
||||
User-data (i.e. [cloud-config]({{site.baseurl}}/os/configuration/#cloud-config)) and metadata from cloud provider, VM runtime, or a management service, is loaded in this service.
|
||||
|
||||
The user-data is written to:
|
||||
|
||||
* `/var/lib/rancher/conf/cloud-config.d/boot.yml` - If the user-data is a cloud-config, i.e. begins with `#cloud-config` and is YAML format.
|
||||
* `/var/lib/rancher/conf/cloud-config-script` - If the user-data is a script, i.e begins with `#!`.
|
||||
* `/var/lib/rancher/conf/metadata` - If it is serialized cloud provider metadata.
|
||||
|
||||
It is configured by the `rancher.cloud_init.datasources` list in [cloud-config]({{site.baseurl}}/os/configuration/#cloud-config). It is pre-configured in cloud-provider specific images (e.g. AWS, GCE).
|
||||
|
||||
### network-pre
|
||||
### network
|
||||
|
||||
During this service, networking is set up, e.g. hostname, interfaces, and DNS.
|
||||
|
||||
@@ -58,16 +23,6 @@ It is configured by `hostname` and `rancher.network`[settings]({{site.baseurl}}/
|
||||
|
||||
Runs `ntpd` in a System Docker container.
|
||||
|
||||
### cloud-init
|
||||
|
||||
It does the same thing as cloud-init-pre, but in this step, it can also use the network to fetch user-data and metadata (e.g. in cloud providers).
|
||||
|
||||
|
||||
### network
|
||||
|
||||
Completes setting up networking with configuration obtained by cloud-init.
|
||||
|
||||
|
||||
### console
|
||||
|
||||
This service provides the RancherOS user interface by running `sshd` and `getty`. It completes the RancherOS configuration on start up:
|
||||
@@ -90,20 +45,8 @@ This service provides the RancherOS user interface by running `sshd` and `getty`
|
||||
|
||||
6. Runs `/etc/rc.local` if it exists and is executable. Any errors are ignored.
|
||||
|
||||
|
||||
### docker
|
||||
|
||||
This system service runs the user docker daemon. Normally it runs inside the console system container by running `docker-init` script which, in turn, looks for docker binaries in `/opt/bin`, `/usr/local/bin` and `/usr/bin`, adds the first found directory with docker binaries to PATH and runs `dockerlaunch docker daemon` appending the passed arguments.
|
||||
|
||||
Docker daemon args are read from `rancher.docker.args` cloud-config property (followed by `rancher.docker.extra_args`).
|
||||
|
||||
### RancherOS Configuration Load Order
|
||||
|
||||
[Cloud-config]({{site.baseurl}}/os/configuration/#cloud-config/) is read by system services when they need to get configuration. Each additional file overwrites and extends the previous configuration file.
|
||||
|
||||
1. `/usr/share/ros/os-config.yml` - This is the system default configuration, which should **not** be modified by users.
|
||||
2. `/usr/share/ros/oem/oem-config.yml` - This will typically exist by OEM, which should **not** be modified by users.
|
||||
3. Files in `/var/lib/rancher/conf/cloud-config.d/` ordered by filename. If a file is passed in through user-data, it is written by cloud-init and saved as `/var/lib/rancher/conf/cloud-config.d/boot.yml`.
|
||||
4. `/var/lib/rancher/conf/cloud-config.yml` - If you set anything with `ros config set`, the changes are saved in this file.
|
||||
5. Kernel parameters with names starting with `rancher`.
|
||||
6. `/var/lib/rancher/conf/metadata` - Metadata added by cloud-init.
|
28
docs/os/boot-process/cloud-init/index.md
Normal file
28
docs/os/boot-process/cloud-init/index.md
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
title: Cloud-init
|
||||
layout: os-default
|
||||
|
||||
---
|
||||
|
||||
## Cloud-init
|
||||
|
||||
Userdata and metadata can be fetched from a cloud provider, VM runtime, or management service during the RancherOS boot process. Since v0.8.0, this process occurs while RancherOS is still running from memory and before System Docker starts. It is configured by the `rancher.cloud_init.datasources` configuration parameter. For cloud-provider specific images, such as AWS and GCE, the datasource is pre-configured.
|
||||
|
||||
### Userdata
|
||||
|
||||
Userdata is a file given by users when launching RancherOS hosts. It is stored in different locations depending on its format. If the userdata is a [cloud-config]({{site.baseurl}}/os/configuration/#cloud-config) file, indicated by beginning with `#cloud-config` and being in YAML format, it is stored in `/var/lib/rancher/conf/cloud-config.d/boot.yml`. If the userdata is a script, indicated by beginning with `#!`, it is stored in `/var/lib/rancher/conf/cloud-config-script`.
|
||||
|
||||
### Metadata
|
||||
|
||||
Although the specifics vary based on provider, a metadata file will typically contain information about the RancherOS host and contain additional configuration. Its primary purpose within RancherOS is to provide an alternate source for SSH keys and hostname configuration. For example, AWS launches hosts with a set of authorized keys and RancherOS obtains these via metadata. Metadata is stored in `/var/lib/rancher/conf/metadata`.
|
||||
|
||||
## Configuration Load Order
|
||||
|
||||
[Cloud-config]({{site.baseurl}}/os/configuration/#cloud-config/) is read by system services when they need to get configuration. Each additional file overwrites and extends the previous configuration file.
|
||||
|
||||
1. `/usr/share/ros/os-config.yml` - This is the system default configuration, which should **not** be modified by users.
|
||||
2. `/usr/share/ros/oem/oem-config.yml` - This will typically exist by OEM, which should **not** be modified by users.
|
||||
3. Files in `/var/lib/rancher/conf/cloud-config.d/` ordered by filename. If a file is passed in through user-data, it is written by cloud-init and saved as `/var/lib/rancher/conf/cloud-config.d/boot.yml`.
|
||||
4. `/var/lib/rancher/conf/cloud-config.yml` - If you set anything with `ros config set`, the changes are saved in this file.
|
||||
5. Kernel parameters with names starting with `rancher`.
|
||||
6. `/var/lib/rancher/conf/metadata` - Metadata added by cloud-init.
|
@@ -1,10 +1,12 @@
|
||||
---
|
||||
title: Pre-packing Docker Images
|
||||
title: Image Preloading
|
||||
layout: os-default
|
||||
redirect_from:
|
||||
- os/configuration/prepacking-docker-images/
|
||||
|
||||
---
|
||||
|
||||
## Pre-packing Docker Images
|
||||
## Image Preloading
|
||||
---
|
||||
|
||||
On boot, RancherOS scans `/var/lib/rancher/preload/docker` and `/var/lib/rancher/preload/system-docker` directories and tries to load container image archives it finds there, with `docker load` and `system-docker load`.
|
Reference in New Issue
Block a user