File tree 18 files changed +56
-48
lines changed
container-engine/cri-o/templates
container_engine_accelerator/nvidia_gpu/templates
kubespray-defaults/defaults/main
network_plugin/kube-ovn/templates
18 files changed +56
-48
lines changed Original file line number Diff line number Diff line change @@ -327,15 +327,15 @@ insecure_registries = {{ crio_insecure_registries }}
327
327
default_transport = "docker://"
328
328
329
329
# The path to a file containing credentials necessary for pulling images from
330
- # secure registries. The file is similar to that of /var/lib/kubelet /config.json
330
+ # secure registries. The file is similar to that of {{kubelet_root_dir}} /config.json
331
331
global_auth_file = "/etc/crio/config.json"
332
332
333
333
# The image used to instantiate infra containers.
334
334
# This option supports live configuration reload.
335
335
pause_image = "{{ crio_pause_image }}"
336
336
337
337
# The path to a file containing credentials specific for pulling the pause_image from
338
- # above. The file is similar to that of /var/lib/kubelet /config.json
338
+ # above. The file is similar to that of {{kubelet_root_dir}} /config.json
339
339
# This option supports live configuration reload.
340
340
pause_image_auth_file = ""
341
341
Original file line number Diff line number Diff line change 34
34
volumes:
35
35
- name: device-plugin
36
36
hostPath:
37
- path: /var/lib/kubelet /device-plugins
37
+ path: {{kubelet_root_dir}} /device-plugins
38
38
- name: dev
39
39
hostPath:
40
40
path: /dev
Original file line number Diff line number Diff line change 37
37
value: unix:/csi/csi.sock
38
38
volumeMounts:
39
39
- name: kubelet-dir
40
- mountPath: /var/lib/kubelet
40
+ mountPath: {{kubelet_root_dir}}
41
41
mountPropagation: "Bidirectional"
42
42
- name: plugin-dir
43
43
mountPath: /csi
69
69
- name: ADDRESS
70
70
value: /csi/csi.sock
71
71
- name: DRIVER_REG_SOCK_PATH
72
- value: /var/lib/kubelet /plugins/ebs.csi.aws.com/csi.sock
72
+ value: {{kubelet_root_dir}} /plugins/ebs.csi.aws.com/csi.sock
73
73
volumeMounts:
74
74
- name: plugin-dir
75
75
mountPath: /csi
@@ -85,15 +85,15 @@ spec:
85
85
volumes:
86
86
- name: kubelet-dir
87
87
hostPath:
88
- path: /var/lib/kubelet
88
+ path: {{kubelet_root_dir}}
89
89
type: Directory
90
90
- name: plugin-dir
91
91
hostPath:
92
- path: /var/lib/kubelet /plugins/ebs.csi.aws.com/
92
+ path: {{kubelet_root_dir}} /plugins/ebs.csi.aws.com/
93
93
type: DirectoryOrCreate
94
94
- name: registration-dir
95
95
hostPath:
96
- path: /var/lib/kubelet /plugins_registry/
96
+ path: {{kubelet_root_dir}} /plugins_registry/
97
97
type: Directory
98
98
- name: device-dir
99
99
hostPath:
Original file line number Diff line number Diff line change 65
65
- name: ADDRESS
66
66
value: /csi/csi.sock
67
67
- name: DRIVER_REG_SOCK_PATH
68
- value: /var/lib/kubelet /plugins/disk.csi.azure.com/csi.sock
68
+ value: {{kubelet_root_dir}} /plugins/disk.csi.azure.com/csi.sock
69
69
volumeMounts:
70
70
- name: socket-dir
71
71
mountPath: /csi
@@ -120,7 +120,7 @@ spec:
120
120
volumeMounts:
121
121
- mountPath: /csi
122
122
name: socket-dir
123
- - mountPath: /var/lib/kubelet /
123
+ - mountPath: {{kubelet_root_dir}} /
124
124
mountPropagation: Bidirectional
125
125
name: mountpoint-dir
126
126
- mountPath: /etc/kubernetes/
@@ -139,15 +139,15 @@ spec:
139
139
memory: 20Mi
140
140
volumes:
141
141
- hostPath:
142
- path: /var/lib/kubelet /plugins/disk.csi.azure.com
142
+ path: {{kubelet_root_dir}} /plugins/disk.csi.azure.com
143
143
type: DirectoryOrCreate
144
144
name: socket-dir
145
145
- hostPath:
146
- path: /var/lib/kubelet /
146
+ path: {{kubelet_root_dir}} /
147
147
type: DirectoryOrCreate
148
148
name: mountpoint-dir
149
149
- hostPath:
150
- path: /var/lib/kubelet /plugins_registry/
150
+ path: {{kubelet_root_dir}} /plugins_registry/
151
151
type: DirectoryOrCreate
152
152
name: registration-dir
153
153
- secret:
Original file line number Diff line number Diff line change 31
31
- name: ADDRESS
32
32
value: /csi/csi.sock
33
33
- name: DRIVER_REG_SOCK_PATH
34
- value: /var/lib/kubelet /plugins/cinder.csi.openstack.org/csi.sock
34
+ value: {{kubelet_root_dir}} /plugins/cinder.csi.openstack.org/csi.sock
35
35
- name: KUBE_NODE_NAME
36
36
valueFrom:
37
37
fieldRef:
81
81
- name: socket-dir
82
82
mountPath: /csi
83
83
- name: kubelet-dir
84
- mountPath: /var/lib/kubelet
84
+ mountPath: {{kubelet_root_dir}}
85
85
mountPropagation: "Bidirectional"
86
86
- name: pods-probe-dir
87
87
mountPath: /dev
@@ -107,15 +107,15 @@ spec:
107
107
volumes:
108
108
- name: socket-dir
109
109
hostPath:
110
- path: /var/lib/kubelet /plugins/cinder.csi.openstack.org
110
+ path: {{kubelet_root_dir}} /plugins/cinder.csi.openstack.org
111
111
type: DirectoryOrCreate
112
112
- name: registration-dir
113
113
hostPath:
114
- path: /var/lib/kubelet /plugins_registry/
114
+ path: {{kubelet_root_dir}} /plugins_registry/
115
115
type: Directory
116
116
- name: kubelet-dir
117
117
hostPath:
118
- path: /var/lib/kubelet
118
+ path: {{kubelet_root_dir}}
119
119
type: Directory
120
120
- name: pods-probe-dir
121
121
hostPath:
Original file line number Diff line number Diff line change 25
25
args:
26
26
- "--v=5"
27
27
- "--csi-address=/csi/csi.sock"
28
- - "--kubelet-registration-path=/var/lib/kubelet /plugins/pd.csi.storage.gke.io/csi.sock"
28
+ - "--kubelet-registration-path={{kubelet_root_dir}} /plugins/pd.csi.storage.gke.io/csi.sock"
29
29
lifecycle:
30
30
preStop:
31
31
exec:
52
52
- "--run-controller-service=false"
53
53
volumeMounts:
54
54
- name: kubelet-dir
55
- mountPath: /var/lib/kubelet
55
+ mountPath: {{kubelet_root_dir}}
56
56
mountPropagation: "Bidirectional"
57
57
- name: plugin-dir
58
58
mountPath: /csi
@@ -73,15 +73,15 @@ spec:
73
73
volumes:
74
74
- name: registration-dir
75
75
hostPath:
76
- path: /var/lib/kubelet /plugins_registry/
76
+ path: {{kubelet_root_dir}} /plugins_registry/
77
77
type: Directory
78
78
- name: kubelet-dir
79
79
hostPath:
80
- path: /var/lib/kubelet
80
+ path: {{kubelet_root_dir}}
81
81
type: Directory
82
82
- name: plugin-dir
83
83
hostPath:
84
- path: /var/lib/kubelet /plugins/pd.csi.storage.gke.io/
84
+ path: {{kubelet_root_dir}} /plugins/pd.csi.storage.gke.io/
85
85
type: DirectoryOrCreate
86
86
- name: device-dir
87
87
hostPath:
Original file line number Diff line number Diff line change 27
27
- name: ADDRESS
28
28
value: /csi/csi.sock
29
29
- name: DRIVER_REG_SOCK_PATH
30
- value: /var/lib/kubelet /plugins/storage.csi.upcloud.com/csi.sock
30
+ value: {{kubelet_root_dir}} /plugins/storage.csi.upcloud.com/csi.sock
31
31
- name: KUBE_NODE_NAME
32
32
valueFrom:
33
33
fieldRef:
70
70
- name: plugin-dir
71
71
mountPath: /csi
72
72
- name: pods-mount-dir
73
- mountPath: /var/lib/kubelet
73
+ mountPath: {{kubelet_root_dir}}
74
74
# needed so that any mounts setup inside this container are
75
75
# propagated back to the host machine.
76
76
mountPropagation: "Bidirectional"
@@ -81,15 +81,15 @@ spec:
81
81
volumes:
82
82
- name: registration-dir
83
83
hostPath:
84
- path: /var/lib/kubelet /plugins_registry/
84
+ path: {{kubelet_root_dir}} /plugins_registry/
85
85
type: DirectoryOrCreate
86
86
- name: plugin-dir
87
87
hostPath:
88
- path: /var/lib/kubelet /plugins/storage.csi.upcloud.com
88
+ path: {{kubelet_root_dir}} /plugins/storage.csi.upcloud.com
89
89
type: DirectoryOrCreate
90
90
- name: pods-mount-dir
91
91
hostPath:
92
- path: /var/lib/kubelet
92
+ path: {{kubelet_root_dir}}
93
93
type: Directory
94
94
- name: device-dir
95
95
hostPath:
Original file line number Diff line number Diff line change 48
48
- name: ADDRESS
49
49
value: /csi/csi.sock
50
50
- name: DRIVER_REG_SOCK_PATH
51
- value: /var/lib/kubelet /plugins/csi.vsphere.vmware.com/csi.sock
51
+ value: {{kubelet_root_dir}} /plugins/csi.vsphere.vmware.com/csi.sock
52
52
volumeMounts:
53
53
- name: plugin-dir
54
54
mountPath: /csi
58
58
exec:
59
59
command:
60
60
- /csi-node-driver-registrar
61
- - --kubelet-registration-path=/var/lib/kubelet /plugins/csi.vsphere.vmware.com/csi.sock
61
+ - --kubelet-registration-path={{kubelet_root_dir}} /plugins/csi.vsphere.vmware.com/csi.sock
62
62
- --mode=kubelet-registration-probe
63
63
initialDelaySeconds: 3
64
64
- name: vsphere-csi-node
@@ -104,7 +104,7 @@ spec:
104
104
- name: plugin-dir
105
105
mountPath: /csi
106
106
- name: pods-mount-dir
107
- mountPath: /var/lib/kubelet
107
+ mountPath: {{kubelet_root_dir}}
108
108
# needed so that any mounts setup inside this container are
109
109
# propagated back to the host machine.
110
110
mountPropagation: "Bidirectional"
@@ -142,15 +142,15 @@ spec:
142
142
volumes:
143
143
- name: registration-dir
144
144
hostPath:
145
- path: /var/lib/kubelet /plugins_registry
145
+ path: {{kubelet_root_dir}} /plugins_registry
146
146
type: Directory
147
147
- name: plugin-dir
148
148
hostPath:
149
- path: /var/lib/kubelet /plugins/csi.vsphere.vmware.com
149
+ path: {{kubelet_root_dir}} /plugins/csi.vsphere.vmware.com
150
150
type: DirectoryOrCreate
151
151
- name: pods-mount-dir
152
152
hostPath:
153
- path: /var/lib/kubelet
153
+ path: {{kubelet_root_dir}}
154
154
type: Directory
155
155
- name: device-dir
156
156
hostPath:
Original file line number Diff line number Diff line change 12
12
13
13
- name : Kubeadm | Check if kubeadm has already run
14
14
stat :
15
- path : " /var/lib/kubelet /config.yaml"
15
+ path : " {{kubelet_root_dir}} /config.yaml"
16
16
get_attributes : false
17
17
get_checksum : false
18
18
get_mime : false
Original file line number Diff line number Diff line change 3
3
lineinfile :
4
4
path : " {{ kube_config_dir }}/kubelet.conf"
5
5
regexp : ' ^ client-certificate-data: '
6
- line : ' client-certificate: /var/lib/kubelet/ pki/kubelet-client-current.pem'
6
+ line : " client-certificate: {{kubelet_root_dir}}/ pki/kubelet-client-current.pem"
7
7
backup : true
8
8
notify :
9
9
- " Control plane | reload kubelet"
12
12
lineinfile :
13
13
path : " {{ kube_config_dir }}/kubelet.conf"
14
14
regexp : ' ^ client-key-data: '
15
- line : ' client-key: /var/lib/kubelet/ pki/kubelet-client-current.pem'
15
+ line : " client-key: {{kubelet_root_dir}}/ pki/kubelet-client-current.pem"
16
16
backup : true
17
17
notify :
18
18
- " Control plane | reload kubelet"
Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ loadbalancer_apiserver_pod_name: "{% if loadbalancer_apiserver_type == 'nginx' %
110
110
# A port range to reserve for services with NodePort visibility.
111
111
# Inclusive at both ends of the range.
112
112
kube_apiserver_node_port_range : " 30000-32767"
113
-
113
+ kubelet_root_dir : /var/lib/kubelet
114
114
# Configure the amount of pods able to run on single node
115
115
# default is equal to application default
116
116
kubelet_max_pods : 110
Original file line number Diff line number Diff line change 15
15
16
16
- name : Kube-vip | Check if kubeadm has already run
17
17
stat :
18
- path : " /var/lib/kubelet /config.yaml"
18
+ path : " {{kubelet_root_dir}} /config.yaml"
19
19
get_attributes : false
20
20
get_checksum : false
21
21
get_mime : false
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}"
12
12
--kubeconfig={{ kube_config_dir }}/kubelet.conf \
13
13
{# end kubeadm specific settings #}
14
14
--runtime-cgroups={{ kubelet_runtime_cgroups }} \
15
+ --root-dir={{ kubelet_root_dir }} \
15
16
{% endset %}
16
17
17
18
KUBELET_ARGS="{{ kubelet_args_base }} {{ kubelet_custom_flags | join(' ') }}"
Original file line number Diff line number Diff line change 148
148
149
149
- name : Set alternate flexvolume path
150
150
set_fact :
151
- kubelet_flexvolumes_plugins_dir : /var/lib/kubelet/ volumeplugins
151
+ kubelet_flexvolumes_plugins_dir : " {{kubelet_root_dir}}/ volumeplugins"
152
152
when : not usr.stat.writeable
Original file line number Diff line number Diff line change 107
107
- kube_network_plugin not in ['calico', 'none']
108
108
- ipv4_stack | bool
109
109
110
+ - name : " Kubelet: check root-dir is not set as custom-flag too"
111
+ assert :
112
+ that : " {{item.split('=')[0] != '--root-dir'}}"
113
+ fail_msg : " kubelet root dir is set via `kubelet_root_dir` variable. Remove it from the kubelet_custom_flags and set the new var"
114
+ loop : " {{kubelet_custom_flags | d([])}}"
115
+
110
116
- name : Stop if ip var does not match local ips
111
117
assert :
112
118
that : (ip in ansible_all_ipv4_addresses) or (ip in ansible_all_ipv6_addresses)
Original file line number Diff line number Diff line change @@ -565,6 +565,7 @@ kubelet_rotate_server_certificates: false
565
565
# If set to true, kubelet errors if any of kernel tunables is different than kubelet defaults
566
566
kubelet_protect_kernel_defaults : true
567
567
568
+ kubelet_root_dir : /var/lib/kubelet
568
569
# Set additional sysctl variables to modify Linux kernel variables, for example:
569
570
# additional_sysctl:
570
571
# - { name: kernel.pid_max, value: 131072 }
Original file line number Diff line number Diff line change @@ -517,7 +517,7 @@ spec:
517
517
path: /lib/modules
518
518
- name: shared-dir
519
519
hostPath:
520
- path: /var/lib/kubelet /pods
520
+ path: {{kubelet_root_dir}} /pods
521
521
- name: systemid
522
522
hostPath:
523
523
path: /etc/origin/openvswitch
Original file line number Diff line number Diff line change 159
159
- services
160
160
161
161
- name : Reset | gather mounted kubelet dirs
162
- shell : set -o pipefail && mount | grep /var/lib/kubelet / | awk '{print $3}' | tac
162
+ shell : set -o pipefail && mount | grep {{kubelet_root_dir}} / | awk '{print $3}' | tac
163
163
args :
164
164
executable : /bin/bash
165
165
check_mode : false
241
241
- enable_nodelocaldns | default(false) | bool
242
242
- nodelocaldns_device.stat.exists
243
243
244
- - name : Reset | Check whether /var/lib/kubelet directory exists
244
+ - name : Reset | Check whether {{kubelet_root_dir}} directory exists
245
245
stat :
246
- path : /var/lib/kubelet
246
+ path : " {{kubelet_root_dir}} "
247
247
get_attributes : false
248
248
get_checksum : false
249
249
get_mime : false
250
250
register : var_lib_kubelet_directory
251
251
252
- - name : Reset | Find files/dirs with immutable flag in /var/lib/kubelet
253
- command : lsattr -laR /var/lib/kubelet /
252
+ - name : Reset | Find files/dirs with immutable flag in {{kubelet_root_dir}}
253
+ command : lsattr -laR {{kubelet_root_dir}} /
254
254
become : true
255
255
register : var_lib_kubelet_files_dirs_w_attrs
256
256
changed_when : false
257
257
no_log : true
258
258
when : var_lib_kubelet_directory.stat.exists
259
259
260
- - name : Reset | Remove immutable flag from files/dirs in /var/lib/kubelet
260
+ - name : Reset | Remove immutable flag from files/dirs in {{kubelet_root_dir}}
261
261
file :
262
262
path : " {{ filedir_path }}"
263
263
state : touch
277
277
state : absent
278
278
with_items :
279
279
- " {{ kube_config_dir }}"
280
- - /var/lib/kubelet
280
+ - {{kubelet_root_dir}}
281
281
- " {{ containerd_storage_dir }}"
282
282
- " {{ ansible_env.HOME | default('/root') }}/.kube"
283
283
- " {{ ansible_env.HOME | default('/root') }}/.helm"
You can’t perform that action at this time.
0 commit comments