From a4376c9ddd4e3b1dbd5814a6ab393ff43d551609 Mon Sep 17 00:00:00 2001 From: Spencer Smith Date: Thu, 17 Nov 2016 12:03:41 -0500 Subject: [PATCH 1/3] add restart flag for docker run kubelet --- roles/kubernetes/node/templates/kubelet-container.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/kubernetes/node/templates/kubelet-container.j2 b/roles/kubernetes/node/templates/kubelet-container.j2 index 2fcc7307f..ad26a9107 100644 --- a/roles/kubernetes/node/templates/kubelet-container.j2 +++ b/roles/kubernetes/node/templates/kubelet-container.j2 @@ -1,6 +1,6 @@ #!/bin/bash /usr/bin/docker run --privileged --rm \ ---net=host --pid=host --name=kubelet \ +--net=host --pid=host --name=kubelet --restart=always \ -v /etc/cni:/etc/cni:ro \ -v /opt/cni:/opt/cni:ro \ -v /etc/kubernetes:/etc/kubernetes \ From c9b07618dc4c9137ca43e29925191e4812b79f2a Mon Sep 17 00:00:00 2001 From: Spencer Smith Date: Thu, 17 Nov 2016 12:21:30 -0500 Subject: [PATCH 2/3] remove the --rm b/c it conflicts with restart --- roles/kubernetes/node/templates/kubelet-container.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/kubernetes/node/templates/kubelet-container.j2 b/roles/kubernetes/node/templates/kubelet-container.j2 index ad26a9107..f6ebc5657 100644 --- a/roles/kubernetes/node/templates/kubelet-container.j2 +++ b/roles/kubernetes/node/templates/kubelet-container.j2 @@ -1,5 +1,5 @@ #!/bin/bash -/usr/bin/docker run --privileged --rm \ +/usr/bin/docker run --privileged \ --net=host --pid=host --name=kubelet --restart=always \ -v /etc/cni:/etc/cni:ro \ -v /opt/cni:/opt/cni:ro \ From 106dcc38987fdfa59de281358f0a65545e2823e8 Mon Sep 17 00:00:00 2001 From: Spencer Smith Date: Fri, 18 Nov 2016 14:33:22 -0500 Subject: [PATCH 3/3] updated all instances of restart always to restart on-failure with a max of 5 times --- roles/etcd/templates/deb-etcd-docker.initd.j2 | 2 +- roles/etcd/templates/etcd-docker.service.j2 | 2 +- roles/kubernetes/node/templates/kubelet-container.j2 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/etcd/templates/deb-etcd-docker.initd.j2 b/roles/etcd/templates/deb-etcd-docker.initd.j2 index 4457b37b9..0489cd2f5 100644 --- a/roles/etcd/templates/deb-etcd-docker.initd.j2 +++ b/roles/etcd/templates/deb-etcd-docker.initd.j2 @@ -17,7 +17,7 @@ DESC="etcd k/v store" NAME=etcd DAEMON={{ docker_bin_dir | default("/usr/bin") }}/docker DAEMON_EXEC=`basename $DAEMON` -DAEMON_ARGS="run --restart=always --env-file=/etc/etcd.env \ +DAEMON_ARGS="run --restart=on-failure:5 --env-file=/etc/etcd.env \ --net=host \ -v /etc/ssl/certs:/etc/ssl/certs:ro \ -v /var/lib/etcd:/var/lib/etcd:rw \ diff --git a/roles/etcd/templates/etcd-docker.service.j2 b/roles/etcd/templates/etcd-docker.service.j2 index ff40b5b59..d18a91f42 100644 --- a/roles/etcd/templates/etcd-docker.service.j2 +++ b/roles/etcd/templates/etcd-docker.service.j2 @@ -6,7 +6,7 @@ After=docker.service [Service] User=root PermissionsStartOnly=true -ExecStart={{ docker_bin_dir | default("/usr/bin") }}/docker run --restart=always \ +ExecStart={{ docker_bin_dir | default("/usr/bin") }}/docker run --restart=on-failure:5 \ --env-file=/etc/etcd.env \ {# TODO(mattymo): Allow docker IP binding and disable in envfile -p 2380:2380 -p 2379:2379 #} diff --git a/roles/kubernetes/node/templates/kubelet-container.j2 b/roles/kubernetes/node/templates/kubelet-container.j2 index f6ebc5657..e460ed114 100644 --- a/roles/kubernetes/node/templates/kubelet-container.j2 +++ b/roles/kubernetes/node/templates/kubelet-container.j2 @@ -1,6 +1,6 @@ #!/bin/bash /usr/bin/docker run --privileged \ ---net=host --pid=host --name=kubelet --restart=always \ +--net=host --pid=host --name=kubelet --restart=on-failure:5 \ -v /etc/cni:/etc/cni:ro \ -v /opt/cni:/opt/cni:ro \ -v /etc/kubernetes:/etc/kubernetes \