Skip to content

Commit 4e9eb89

Browse files
authored
Run the deploy job on a systemd node (#40)
Provisioning failed once it reached the application layer: System has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down cloudmon deploys through systemd -- 15 unit templates, 68 systemd tasks and 14 daemon_reload calls -- so the node needs a real init. Switch the nodeset to the new zuul-debian-systemd label, which runs systemd as PID 1. With systemd present, let it own containerd and dockerd instead of starting them with nohup; hand-started daemons would collide with the units the cloudmon roles enable. The daemon settings now come from /etc/docker/daemon.json seeded by the pod spec. Diagnostics read the journal instead of the log files the manual start used to write. Verified on a probe pod on the cluster: PID 1 is systemd, is-system-running reports running, daemon-reload succeeds, and a unit written at runtime can be enabled and started.
1 parent 658e724 commit 4e9eb89

2 files changed

Lines changed: 23 additions & 41 deletions

File tree

‎playbooks_k8s/run.yaml‎

Lines changed: 22 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -100,40 +100,22 @@
100100
- /var/run/docker.pid
101101
failed_when: false
102102

103-
# Start daemons directly — the pod has no init system to do it.
104-
#
105-
# dockerd flags:
106-
# --exec-opt native.cgroupdriver=cgroupfs
107-
# The pod has no systemd; dockerd's default cgroup driver is
108-
# "systemd" and would fail.
109-
# --iptables=false --ip6tables=false
110-
# The pod may lack CAP_NET_ADMIN even when "privileged" is set
111-
# (depending on the cluster's security policy). Disabling
112-
# iptables lets dockerd start without NAT rules; containers
113-
# use host networking which is all the provision playbooks need
114-
# (single-node, localhost inventory).
115-
# --bridge=none
116-
# Same reason — no bridge network needed.
117-
- name: Start containerd daemon
118-
ansible.builtin.shell:
119-
cmd: nohup /usr/bin/containerd > /var/log/containerd.log 2>&1 &
120-
changed_when: true
121-
122-
- name: Wait for containerd socket (up to 30s)
123-
ansible.builtin.wait_for:
124-
path: /run/containerd/containerd.sock
125-
timeout: 30
126-
127-
- name: Start dockerd daemon
128-
ansible.builtin.shell:
129-
cmd: >-
130-
nohup /usr/bin/dockerd
131-
--exec-opt native.cgroupdriver=cgroupfs
132-
--iptables=false
133-
--ip6tables=false
134-
--bridge=none
135-
> /var/log/dockerd.log 2>&1 &
136-
changed_when: true
103+
# The node runs systemd as PID 1 (zuul-debian-systemd label), so let it own
104+
# the daemons. Starting them by hand would collide with the units the
105+
# cloudmon roles later enable. Daemon settings (MTU, cgroupdriver,
106+
# iptables/bridge) are seeded into /etc/docker/daemon.json by the pod spec.
107+
- name: Start containerd via systemd
108+
ansible.builtin.systemd:
109+
name: containerd
110+
state: started
111+
enabled: true
112+
daemon_reload: true
113+
114+
- name: Start dockerd via systemd
115+
ansible.builtin.systemd:
116+
name: docker
117+
state: started
118+
enabled: true
137119

138120
- name: Wait for Docker socket to appear (up to 60s)
139121
ansible.builtin.wait_for:
@@ -158,14 +140,14 @@
158140

159141
- name: Show dockerd log (last 100 lines)
160142
ansible.builtin.command:
161-
cmd: tail -n 100 /var/log/dockerd.log
143+
cmd: journalctl -u docker --no-pager -n 100
162144
register: dockerd_tail
163145
changed_when: false
164146
failed_when: false
165147

166148
- name: Show containerd log (last 100 lines)
167149
ansible.builtin.command:
168-
cmd: tail -n 100 /var/log/containerd.log
150+
cmd: journalctl -u containerd --no-pager -n 100
169151
register: containerd_tail
170152
changed_when: false
171153
failed_when: false
@@ -175,10 +157,10 @@
175157
msg: |-
176158
Docker daemon failed to start after 60s.
177159
dockerd process: {{ dockerd_ps.stdout_lines | default(['no process found']) }}
178-
dockerd log:
179-
{{ dockerd_tail.stdout | default('no log file') }}
180-
containerd log:
181-
{{ containerd_tail.stdout | default('no log file') }}
160+
docker journal:
161+
{{ dockerd_tail.stdout | default('no journal output') }}
162+
containerd journal:
163+
{{ containerd_tail.stdout | default('no journal output') }}
182164
183165
- hosts: all
184166
become: true

‎zuul.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
nodeset:
4444
nodes:
4545
- name: zuul-debian
46-
label: zuul-debian-docker
46+
label: zuul-debian-systemd
4747

4848
- project:
4949
merge-mode: squash-merge

0 commit comments

Comments
 (0)