File: node.yaml

package info (click to toggle)
containerd 2.1.4~ds2-5
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 21,772 kB
  • sloc: sh: 1,885; makefile: 591
file content (195 lines) | stat: -rw-r--r-- 6,203 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#cloud-config

write_files:
# Setup containerd.
  - path: /etc/systemd/system/containerd-installation.service
    permissions: 0644
    owner: root
    content: |
      # installed by cloud-init
      [Unit]
      Description=Download and install containerd binaries and configurations.
      After=network-online.target

      [Service]
      Type=oneshot
      RemainAfterExit=yes
      ExecStartPre=/bin/mkdir -p /home/containerd
      ExecStartPre=/bin/mount --bind /home/containerd /home/containerd
      ExecStartPre=/bin/mount -o remount,exec /home/containerd
      ExecStartPre=/usr/bin/curl --fail --retry 5 --retry-delay 3 --silent --show-error -H "X-Google-Metadata-Request: True" -o /home/containerd/configure.sh http://metadata.google.internal/computeMetadata/v1/instance/attributes/containerd-configure-sh
      ExecStartPre=/bin/chmod 544 /home/containerd/configure.sh
      ExecStart=/home/containerd/configure.sh

      [Install]
      WantedBy=containerd.target

  - path: /etc/systemd/system/containerd.service
    permissions: 0644
    owner: root
    content: |
      # installed by cloud-init
      [Unit]
      Description=containerd container runtime
      Documentation=https://containerd.io
      After=containerd-installation.service

      [Service]
      Restart=always
      RestartSec=5
      Delegate=yes
      KillMode=process
      OOMScoreAdjust=-999
      LimitNOFILE=1048576
      # Having non-zero Limit*s causes performance problems due to accounting overhead
      # in the kernel. We recommend using cgroups to do container-local accounting.
      LimitNPROC=infinity
      LimitCORE=infinity
      TasksMax=infinity
      ExecStartPre=/sbin/modprobe overlay
      EnvironmentFile=-/etc/containerd/containerd.env
      ExecStart=/home/containerd/usr/local/bin/containerd

      [Install]
      WantedBy=containerd.target

  - path: /etc/systemd/system/containerd.target
    permissions: 0644
    owner: root
    content: |
      [Unit]
      Description=Containerd

      [Install]
      WantedBy=kubernetes.target

# Setup kubernetes.
  - path: /etc/systemd/system/kube-node-installation.service
    permissions: 0644
    owner: root
    content: |
      [Unit]
      Description=Download and install k8s binaries and configurations
      After=network-online.target containerd.target
      Wants=network-online.target containerd.target

      [Service]
      Type=oneshot
      RemainAfterExit=yes
      ExecStartPre=/bin/mkdir -p /home/kubernetes/bin
      ExecStartPre=/bin/mount --bind /home/kubernetes/bin /home/kubernetes/bin
      ExecStartPre=/bin/mount -o remount,exec /home/kubernetes/bin
      ExecStartPre=/usr/bin/curl --fail --retry 5 --retry-delay 3 --silent --show-error	-H "X-Google-Metadata-Request: True" -o /home/kubernetes/bin/configure.sh http://metadata.google.internal/computeMetadata/v1/instance/attributes/configure-sh
      ExecStartPre=/bin/chmod 544 /home/kubernetes/bin/configure.sh
      ExecStart=/home/kubernetes/bin/configure.sh

      [Install]
      WantedBy=kubernetes.target

  - path: /etc/systemd/system/kube-node-configuration.service
    permissions: 0644
    owner: root
    content: |
      [Unit]
      Description=Configure kubernetes node
      After=kube-node-installation.service

      [Service]
      Type=oneshot
      RemainAfterExit=yes
      ExecStartPre=/bin/chmod 544 /home/kubernetes/bin/configure-helper.sh
      ExecStart=/home/kubernetes/bin/configure-helper.sh

      [Install]
      WantedBy=kubernetes.target

  - path: /etc/systemd/system/kube-container-runtime-monitor.service
    permissions: 0644
    owner: root
    content: |
      [Unit]
      Description=Kubernetes health monitoring for container runtime
      After=kube-node-configuration.service
      [Service]
      Restart=always
      RestartSec=10
      RemainAfterExit=yes
      RemainAfterExit=yes
      ExecStartPre=/bin/chmod 544 /home/kubernetes/bin/health-monitor.sh
      ExecStart=/home/kubernetes/bin/health-monitor.sh container-runtime
      [Install]
      WantedBy=kubernetes.target

  - path: /etc/systemd/system/kubelet-monitor.service
    permissions: 0644
    owner: root
    content: |
      [Unit]
      Description=Kubernetes health monitoring for kubelet
      After=kube-node-configuration.service

      [Service]
      Restart=always
      RestartSec=10
      RemainAfterExit=yes
      ExecStartPre=/bin/chmod 544 /home/kubernetes/bin/health-monitor.sh
      ExecStart=/home/kubernetes/bin/health-monitor.sh kubelet

      [Install]
      WantedBy=kubernetes.target

  - path: /etc/systemd/system/kube-logrotate.timer
    permissions: 0644
    owner: root
    content: |
      [Unit]
      Description=Hourly kube-logrotate invocation

      [Timer]
      OnCalendar=hourly

      [Install]
      WantedBy=kubernetes.target

  - path: /etc/systemd/system/kube-logrotate.service
    permissions: 0644
    owner: root
    content: |
      [Unit]
      Description=Kubernetes log rotation
      After=kube-node-configuration.service

      [Service]
      Type=oneshot
      ExecStart=-/usr/sbin/logrotate /etc/logrotate.conf

      [Install]
      WantedBy=kubernetes.target

  - path: /etc/systemd/system/kubernetes.target
    permissions: 0644
    owner: root
    content: |
      [Unit]
      Description=Kubernetes

      [Install]
      WantedBy=multi-user.target

runcmd:
  # Stop the existing containerd service if there is one. (for Docker 18.09+)
  - systemctl is-active containerd && systemctl stop containerd
  - systemctl daemon-reload
  - systemctl enable containerd-installation.service
  - systemctl enable containerd.service
  - systemctl enable containerd.target
  - systemctl enable kube-node-installation.service
  - systemctl enable kube-node-configuration.service
  - systemctl enable kubelet-monitor.service
  - systemctl enable kube-container-runtime-monitor.service
  - systemctl enable kube-logrotate.timer
  - systemctl enable kube-logrotate.service
  - systemctl enable kubernetes.target
  - systemctl start kubernetes.target
  # Start docker after containerd is running. (for Docker 18.09+)
  - systemctl is-enabled docker && (systemctl is-active docker || systemctl start docker)