From b4631cf707d8f60418a3fed51975061f17b1a4a0 Mon Sep 17 00:00:00 2001 From: Lantao Liu Date: Mon, 21 May 2018 18:52:15 -0700 Subject: [PATCH] Use crictl installed in kube-up.sh Signed-off-by: Lantao Liu --- cluster/gce/cloud-init/master.yaml | 36 ++++++++++++++---------------- cluster/gce/cloud-init/node.yaml | 36 ++++++++++++++---------------- cluster/gce/configure.sh | 8 +++---- cluster/health-monitor.sh | 4 ++++ 4 files changed, 42 insertions(+), 42 deletions(-) diff --git a/cluster/gce/cloud-init/master.yaml b/cluster/gce/cloud-init/master.yaml index e656ea959..799e651e3 100644 --- a/cluster/gce/cloud-init/master.yaml +++ b/cluster/gce/cloud-init/master.yaml @@ -51,25 +51,6 @@ write_files: [Install] WantedBy=containerd.target - - path: /etc/systemd/system/containerd-monitor.service - permissions: 0644 - owner: root - content: | - [Unit] - Description=Kubernetes health monitoring for containerd - After=containerd.service - - [Service] - Restart=always - RestartSec=10 - RemainAfterExit=yes - ExecStartPre=/bin/chmod 544 /home/containerd/opt/containerd/cluster/health-monitor.sh - ExecStart=/bin/bash -c 'CRICTL=/home/containerd/usr/local/bin/crictl \ - /home/containerd/opt/containerd/cluster/health-monitor.sh' - - [Install] - WantedBy=containerd.target - - path: /etc/systemd/system/containerd.target permissions: 0644 owner: root @@ -119,6 +100,23 @@ write_files: [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-master-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 diff --git a/cluster/gce/cloud-init/node.yaml b/cluster/gce/cloud-init/node.yaml index 7e61f2bc7..937ab5f0e 100644 --- a/cluster/gce/cloud-init/node.yaml +++ b/cluster/gce/cloud-init/node.yaml @@ -51,25 +51,6 @@ write_files: [Install] WantedBy=containerd.target - - path: /etc/systemd/system/containerd-monitor.service - permissions: 0644 - owner: root - content: | - [Unit] - Description=Kubernetes health monitoring for containerd - After=containerd.service - - [Service] - Restart=always - RestartSec=10 - RemainAfterExit=yes - ExecStartPre=/bin/chmod 544 /home/containerd/opt/containerd/cluster/health-monitor.sh - ExecStart=/bin/bash -c 'CRICTL=/home/containerd/usr/local/bin/crictl \ - /home/containerd/opt/containerd/cluster/health-monitor.sh' - - [Install] - WantedBy=containerd.target - - path: /etc/systemd/system/containerd.target permissions: 0644 owner: root @@ -119,6 +100,23 @@ write_files: [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 diff --git a/cluster/gce/configure.sh b/cluster/gce/configure.sh index 809dafa68..636d41078 100755 --- a/cluster/gce/configure.sh +++ b/cluster/gce/configure.sh @@ -133,14 +133,14 @@ else # Download and untar the release tar ball. curl -f --ipv4 -Lo "${TARBALL}" --connect-timeout 20 --max-time 300 --retry 6 --retry-delay 10 "${TARBALL_GCS_PATH}" tar xvf "${TARBALL}" + # Use crictl installed by kube-up.sh. + # TODO(random-liu): Create release tarball for GCE, and do not package crictl. + rm "${CONTAINERD_HOME}/usr/local/bin/crictl" + rm "${CONTAINERD_HOME}/etc/crictl.yaml" rm -f "${TARBALL}" fi fi -# Configure containerd. -# Copy crictl config. -cp "${CONTAINERD_HOME}/etc/crictl.yaml" /etc - # Generate containerd config config_path="${CONTAINERD_CONFIG_PATH:-"/etc/containerd/config.toml"}" mkdir -p $(dirname ${config_path}) diff --git a/cluster/health-monitor.sh b/cluster/health-monitor.sh index 800f4df07..9034e47c2 100755 --- a/cluster/health-monitor.sh +++ b/cluster/health-monitor.sh @@ -17,6 +17,10 @@ set -o nounset set -o pipefail +# TODO(#780): This file is not used by kube-up.sh on +# GCE anymore. We'll get rid of this file in 1.12 release. +# Please stop relying on this script if you are. + # CRICTL is the path of crictl CRICTL=${CRICTL:-"crictl"} # INITIAL_WAIT_ATTEMPTS is the number to attempt, before start