[lxc-devel] [lxd/master] doc: Update cloud-init network documentation

stgraber on Github lxc-bot at linuxcontainers.org
Tue Nov 6 21:21:56 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 370 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20181106/455b26ad/attachment.bin>
-------------- next part --------------
From cf2da22374cec652551060270c47a8f6c172c687 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 6 Nov 2018 15:28:37 -0500
Subject: [PATCH] doc: Update cloud-init network documentation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #5255

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 doc/cloud-init.md | 54 ++++++++---------------------------------------
 1 file changed, 9 insertions(+), 45 deletions(-)

diff --git a/doc/cloud-init.md b/doc/cloud-init.md
index 37b7ddc989..92b734eb64 100644
--- a/doc/cloud-init.md
+++ b/doc/cloud-init.md
@@ -29,10 +29,11 @@ the following in their `metadata.yaml`:
 ```
 
 Therefore, either when you create or copy a container it gets a newly rendered
-network configuration from a pre-defined template. cloud-init uses the
-network-config file to render `/etc/network/interfaces.d/50-cloud-init.cfg` when
-you first start a container. It will not react to any changes if you restart
-a container afterwards unless you force it.
+network configuration from a pre-defined template.
+
+cloud-init uses the network-config file to render the relevant network
+configuration on the system using either ifupdown or netplan depending
+on the Ubuntu release.
 
 The default behavior is to use a DHCP client on a container's eth0 interface.
 
@@ -40,9 +41,6 @@ In order to change this you need to define your own network configuration
 using user.network-config key in the config dictionary which will override
 the default configuration (this is due to how the template is structured).
 
-The allowed values follow `/etc/network/interfaces` syntax in case of Ubuntu
-images.
-
 For example, to configure a specific network interface with a static IPv4
 address and also use a custom nameserver use
 
@@ -67,41 +65,8 @@ config:
 A container's rootfs will contain the following files as a result:
 
  * `/var/lib/cloud/seed/nocloud-net/network-config`
- * `/etc/network/interfaces.d/50-cloud-init.cfg`
-
-The former will be the same as the value provided in user.network-config,
-the latter will be a file in `/etc/network/interfaces` format converted from
-the network-config file by cloud-init (if it is not check syslog for cloud-init
-error messages).
-
-
-`/etc/network/interfaces.d/50-cloud-init.cfg` should then contain
-
-```
-# This file is generated from information provided by
-# the datasource.  Changes to it will not persist across an instance.
-# To disable cloud-init's network configuration capabilities, write a file
-# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
-# network: {config: disabled}
-auto lo
-iface lo inet loopback
-    dns-nameservers 10.10.10.254
-
-auto eth1
-iface eth1 inet static
-    address 10.10.101.20
-    gateway 10.10.101.1
-    netmask 255.255.255.0
-```
-
-You will also notice that `/run/resolvconf/resolv.conf` or `/etc/resolv.conf`
-which is pointing to it will contain the desired dns server after boot-up.
-
-```
-# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
-#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
-nameserver 10.10.10.254
-```
+ * `/etc/network/interfaces.d/50-cloud-init.cfg` (if using ifupdown)
+ * `/etc/netplan/50-cloud-init.yaml` (if using netplan)
 
 # Implementation Details
 
@@ -113,9 +78,9 @@ located at `/var/lib/cloud/seed/nocloud-net`:
  * `vendor-data` (optional)
  * `network-config` (optional)
 
-The network-config file is written to by lxd using data provided in templates
+The network-config file is written to by LXD using data provided in templates
 that come with an image. This is governed by metadata.yaml but naming of the
-configuration keys and template content is not hard-coded as far as lxd is
+configuration keys and template content is not hard-coded as far as LXD is
 concerned - this is purely image data that can be modified if needed.
 
  * [NoCloud data source documentation](https://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html)
@@ -145,4 +110,3 @@ Options available with such a template structure:
  * Use DHCP by default on your eth0 interface;
  * Set `user.network_mode` to `link-local` and configure networking by hand;
  * Seed cloud-init by defining `user.network-config`.
-


More information about the lxc-devel mailing list