github.com/containerd/containerd@v22.0.0-20200918172823-438c87b8e050+incompatible/contrib/gce/cloud-init/node.yaml (about) 1 #cloud-config 2 3 write_files: 4 # Setup containerd. 5 - path: /etc/systemd/system/containerd-installation.service 6 permissions: 0644 7 owner: root 8 content: | 9 # installed by cloud-init 10 [Unit] 11 Description=Download and install containerd binaries and configurations. 12 After=network-online.target 13 14 [Service] 15 Type=oneshot 16 RemainAfterExit=yes 17 ExecStartPre=/bin/mkdir -p /home/containerd 18 ExecStartPre=/bin/mount --bind /home/containerd /home/containerd 19 ExecStartPre=/bin/mount -o remount,exec /home/containerd 20 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 21 ExecStartPre=/bin/chmod 544 /home/containerd/configure.sh 22 ExecStart=/home/containerd/configure.sh 23 24 [Install] 25 WantedBy=containerd.target 26 27 - path: /etc/systemd/system/containerd.service 28 permissions: 0644 29 owner: root 30 content: | 31 # installed by cloud-init 32 [Unit] 33 Description=containerd container runtime 34 Documentation=https://containerd.io 35 After=containerd-installation.service 36 37 [Service] 38 Restart=always 39 RestartSec=5 40 Delegate=yes 41 KillMode=process 42 OOMScoreAdjust=-999 43 LimitNOFILE=1048576 44 # Having non-zero Limit*s causes performance problems due to accounting overhead 45 # in the kernel. We recommend using cgroups to do container-local accounting. 46 LimitNPROC=infinity 47 LimitCORE=infinity 48 TasksMax=infinity 49 ExecStartPre=/sbin/modprobe overlay 50 ExecStart=/home/containerd/usr/local/bin/containerd 51 52 [Install] 53 WantedBy=containerd.target 54 55 - path: /etc/systemd/system/containerd.target 56 permissions: 0644 57 owner: root 58 content: | 59 [Unit] 60 Description=Containerd 61 62 [Install] 63 WantedBy=kubernetes.target 64 65 # Setup kubernetes. 66 - path: /etc/systemd/system/kube-node-installation.service 67 permissions: 0644 68 owner: root 69 content: | 70 [Unit] 71 Description=Download and install k8s binaries and configurations 72 After=network-online.target 73 74 [Service] 75 Type=oneshot 76 RemainAfterExit=yes 77 ExecStartPre=/bin/mkdir -p /home/kubernetes/bin 78 ExecStartPre=/bin/mount --bind /home/kubernetes/bin /home/kubernetes/bin 79 ExecStartPre=/bin/mount -o remount,exec /home/kubernetes/bin 80 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 81 ExecStartPre=/bin/chmod 544 /home/kubernetes/bin/configure.sh 82 ExecStart=/home/kubernetes/bin/configure.sh 83 84 [Install] 85 WantedBy=kubernetes.target 86 87 - path: /etc/systemd/system/kube-node-configuration.service 88 permissions: 0644 89 owner: root 90 content: | 91 [Unit] 92 Description=Configure kubernetes node 93 After=kube-node-installation.service 94 95 [Service] 96 Type=oneshot 97 RemainAfterExit=yes 98 ExecStartPre=/bin/chmod 544 /home/kubernetes/bin/configure-helper.sh 99 ExecStart=/home/kubernetes/bin/configure-helper.sh 100 101 [Install] 102 WantedBy=kubernetes.target 103 104 - path: /etc/systemd/system/kube-container-runtime-monitor.service 105 permissions: 0644 106 owner: root 107 content: | 108 [Unit] 109 Description=Kubernetes health monitoring for container runtime 110 After=kube-node-configuration.service 111 [Service] 112 Restart=always 113 RestartSec=10 114 RemainAfterExit=yes 115 RemainAfterExit=yes 116 ExecStartPre=/bin/chmod 544 /home/kubernetes/bin/health-monitor.sh 117 ExecStart=/home/kubernetes/bin/health-monitor.sh container-runtime 118 [Install] 119 WantedBy=kubernetes.target 120 121 - path: /etc/systemd/system/kubelet-monitor.service 122 permissions: 0644 123 owner: root 124 content: | 125 [Unit] 126 Description=Kubernetes health monitoring for kubelet 127 After=kube-node-configuration.service 128 129 [Service] 130 Restart=always 131 RestartSec=10 132 RemainAfterExit=yes 133 ExecStartPre=/bin/chmod 544 /home/kubernetes/bin/health-monitor.sh 134 ExecStart=/home/kubernetes/bin/health-monitor.sh kubelet 135 136 [Install] 137 WantedBy=kubernetes.target 138 139 - path: /etc/systemd/system/kube-logrotate.timer 140 permissions: 0644 141 owner: root 142 content: | 143 [Unit] 144 Description=Hourly kube-logrotate invocation 145 146 [Timer] 147 OnCalendar=hourly 148 149 [Install] 150 WantedBy=kubernetes.target 151 152 - path: /etc/systemd/system/kube-logrotate.service 153 permissions: 0644 154 owner: root 155 content: | 156 [Unit] 157 Description=Kubernetes log rotation 158 After=kube-node-configuration.service 159 160 [Service] 161 Type=oneshot 162 ExecStart=-/usr/sbin/logrotate /etc/logrotate.conf 163 164 [Install] 165 WantedBy=kubernetes.target 166 167 - path: /etc/systemd/system/kubernetes.target 168 permissions: 0644 169 owner: root 170 content: | 171 [Unit] 172 Description=Kubernetes 173 174 [Install] 175 WantedBy=multi-user.target 176 177 runcmd: 178 # Stop the existing containerd service if there is one. (for Docker 18.09+) 179 - systemctl is-active containerd && systemctl stop containerd 180 - systemctl daemon-reload 181 - systemctl enable containerd-installation.service 182 - systemctl enable containerd.service 183 - systemctl enable containerd.target 184 - systemctl enable kube-node-installation.service 185 - systemctl enable kube-node-configuration.service 186 - systemctl enable kubelet-monitor.service 187 - systemctl enable kube-container-runtime-monitor.service 188 - systemctl enable kube-logrotate.timer 189 - systemctl enable kube-logrotate.service 190 - systemctl enable kubernetes.target 191 - systemctl start kubernetes.target 192 # Start docker after containerd is running. (for Docker 18.09+) 193 - systemctl is-enabled docker && (systemctl is-active docker || systemctl start docker)