Skip to content

Commit b0d3daf

Browse files
committed
kubelet-service: narrow down restorecon path
Previously the `restorecon` command was applies on /var/lib/kubelet/ This caused the command to hang forever on a stale NFS volumes. To minimize the affect of the command this command suggest few things: 1. Narrowing down the path so the command will take affect only for the concrete use case we aware of, where pod-resources changes its label due to: containers/container-selinux#329 2. Add the `i` flag which ignores the path if it doesn't exist. This is done to make sure we're not failing the service in case of missing path. 3. Remove the `v` flag to minimize logging pressure under the node. Signed-off-by: Talor Itzhak <[email protected]>
1 parent 20f2660 commit b0d3daf

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

templates/master/01-master-kubelet/_base/units/kubelet.service.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ contents: |
1010
[Service]
1111
Type=notify
1212
ExecStartPre=/bin/mkdir --parents /etc/kubernetes/manifests
13-
ExecStartPre=-/usr/sbin/restorecon -rv /var/lib/kubelet/ /usr/local/bin/kubenswrapper /usr/bin/kubensenter
13+
ExecStartPre=-/usr/sbin/restorecon -ri /var/lib/kubelet/pod-resources /usr/local/bin/kubenswrapper /usr/bin/kubensenter
1414
{{- if eq .IPFamilies "IPv6"}}
1515
Environment="KUBELET_NODE_IP=::"
1616
{{- else}}

templates/master/01-master-kubelet/on-prem/units/kubelet.service.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ contents: |
1010
[Service]
1111
Type=notify
1212
ExecStartPre=/bin/mkdir --parents /etc/kubernetes/manifests
13-
ExecStartPre=-/usr/sbin/restorecon -rv /var/lib/kubelet/ /usr/local/bin/kubenswrapper /usr/bin/kubensenter
13+
ExecStartPre=-/usr/sbin/restorecon -ri /var/lib/kubelet/pod-resources /usr/local/bin/kubenswrapper /usr/bin/kubensenter
1414
{{- if eq .IPFamilies "IPv6"}}
1515
Environment="KUBELET_NODE_IP=::"
1616
{{- else}}

templates/worker/01-worker-kubelet/_base/units/kubelet.service.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ contents: |
1010
[Service]
1111
Type=notify
1212
ExecStartPre=/bin/mkdir --parents /etc/kubernetes/manifests
13-
ExecStartPre=-/usr/sbin/restorecon -rv /var/lib/kubelet/ /usr/local/bin/kubenswrapper /usr/bin/kubensenter
13+
ExecStartPre=-/usr/sbin/restorecon -ri /var/lib/kubelet/pod-resources /usr/local/bin/kubenswrapper /usr/bin/kubensenter
1414
{{- if eq .IPFamilies "IPv6"}}
1515
Environment="KUBELET_NODE_IP=::"
1616
{{- else}}

templates/worker/01-worker-kubelet/on-prem/units/kubelet.service.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ contents: |
1010
[Service]
1111
Type=notify
1212
ExecStartPre=/bin/mkdir --parents /etc/kubernetes/manifests
13-
ExecStartPre=-/usr/sbin/restorecon -rv /var/lib/kubelet/ /usr/local/bin/kubenswrapper /usr/bin/kubensenter
13+
ExecStartPre=-/usr/sbin/restorecon -ri /var/lib/kubelet/pod-resources /usr/local/bin/kubenswrapper /usr/bin/kubensenter
1414
{{- if eq .IPFamilies "IPv6"}}
1515
Environment="KUBELET_NODE_IP=::"
1616
{{- else}}

0 commit comments

Comments
 (0)