github.com/containerd/containerd@v22.0.0-20200918172823-438c87b8e050+incompatible/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 79 80 [Service] 81 Type=oneshot 82 RemainAfterExit=yes 83 ExecStartPre=/bin/mkdir -p /home/kubernetes/bin 84 ExecStartPre=/bin/mount --bind /home/kubernetes/bin /home/kubernetes/bin 85 ExecStartPre=/bin/mount -o remount,exec /home/kubernetes/bin 86 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 87 ExecStartPre=/bin/chmod 544 /home/kubernetes/bin/configure.sh 88 ExecStart=/home/kubernetes/bin/configure.sh 89 90 [Install] 91 WantedBy=kubernetes.target 92 93 - path: /etc/systemd/system/kube-master-configuration.service 94 permissions: 0644 95 owner: root 96 content: | 97 [Unit] 98 Description=Configure kubernetes master 99 After=kube-master-installation.service 100 101 [Service] 102 Type=oneshot 103 RemainAfterExit=yes 104 ExecStartPre=/bin/chmod 544 /home/kubernetes/bin/configure-helper.sh 105 ExecStart=/home/kubernetes/bin/configure-helper.sh 106 107 [Install] 108 WantedBy=kubernetes.target 109 110 - path: /etc/systemd/system/kube-container-runtime-monitor.service 111 permissions: 0644 112 owner: root 113 content: | 114 [Unit] 115 Description=Kubernetes health monitoring for container runtime 116 After=kube-master-configuration.service 117 [Service] 118 Restart=always 119 RestartSec=10 120 RemainAfterExit=yes 121 RemainAfterExit=yes 122 ExecStartPre=/bin/chmod 544 /home/kubernetes/bin/health-monitor.sh 123 ExecStart=/home/kubernetes/bin/health-monitor.sh container-runtime 124 [Install] 125 WantedBy=kubernetes.target 126 127 - path: /etc/systemd/system/kubelet-monitor.service 128 permissions: 0644 129 owner: root 130 content: | 131 [Unit] 132 Description=Kubernetes health monitoring for kubelet 133 After=kube-master-configuration.service 134 135 [Service] 136 Restart=always 137 RestartSec=10 138 RemainAfterExit=yes 139 ExecStartPre=/bin/chmod 544 /home/kubernetes/bin/health-monitor.sh 140 ExecStart=/home/kubernetes/bin/health-monitor.sh kubelet 141 142 [Install] 143 WantedBy=kubernetes.target 144 145 - path: /etc/systemd/system/kube-logrotate.timer 146 permissions: 0644 147 owner: root 148 content: | 149 [Unit] 150 Description=Hourly kube-logrotate invocation 151 152 [Timer] 153 OnCalendar=hourly 154 155 [Install] 156 WantedBy=kubernetes.target 157 158 - path: /etc/systemd/system/kube-logrotate.service 159 permissions: 0644 160 owner: root 161 content: | 162 [Unit] 163 Description=Kubernetes log rotation 164 After=kube-master-configuration.service 165 166 [Service] 167 Type=oneshot 168 ExecStart=-/usr/sbin/logrotate /etc/logrotate.conf 169 170 [Install] 171 WantedBy=kubernetes.target 172 173 - path: /etc/systemd/system/kubernetes.target 174 permissions: 0644 175 owner: root 176 content: | 177 [Unit] 178 Description=Kubernetes 179 180 [Install] 181 WantedBy=multi-user.target 182 183 runcmd: 184 # Stop the existing containerd service if there is one. (for Docker 18.09+) 185 - systemctl is-active containerd && systemctl stop containerd 186 - systemctl daemon-reload 187 - systemctl enable containerd-installation.service 188 - systemctl enable containerd.service 189 - systemctl enable containerd.target 190 - systemctl enable kube-master-installation.service 191 - systemctl enable kube-master-configuration.service 192 - systemctl enable kubelet-monitor.service 193 - systemctl enable kube-container-runtime-monitor.service 194 - systemctl enable kube-logrotate.timer 195 - systemctl enable kube-logrotate.service 196 - systemctl enable kubernetes.target 197 - systemctl start kubernetes.target 198 # Start docker after containerd is running. (for Docker 18.09+) 199 - systemctl is-enabled docker && (systemctl is-active docker || systemctl start docker)