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