-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable containerd service, Add fix for single machine
- Loading branch information
Showing
4 changed files
with
47 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
systemd: | ||
name: containerd | ||
state: restarted | ||
enabled: true | ||
|
||
- name: Restart kubelet | ||
systemd: | ||
|
39 changes: 39 additions & 0 deletions
39
ansible/playbooks/roles/containerd/tasks/configure-kubelet-env.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# To be replaced by filter plugin (https://github.com/epiphany-platform/epiphany/issues/2943) | ||
- name: Reconfigure kubelet args | ||
notify: | ||
- Restart containerd | ||
- Restart kubelet | ||
block: | ||
- name: Get kubeadm-flags.env file content | ||
slurp: | ||
src: /var/lib/kubelet/kubeadm-flags.env | ||
register: kubelet_kubeadm_args | ||
|
||
- name: Set kubelet_kubeadmn_args_content | ||
set_fact: | ||
kubelet_kubeadmn_args_content: "{{ kubelet_kubeadm_args.content | b64decode }}" | ||
|
||
- name: Modify container-runtime | ||
replace: | ||
path: /var/lib/kubelet/kubeadm-flags.env | ||
regexp: '{{ item.regexp }}' | ||
replace: '{{ item.replace }}' | ||
backup: true | ||
loop: | ||
- { regexp: '^(KUBELET_KUBEADM_ARGS=\")(.*)(--container-runtime=[a-zA-Z0-9_]+)(.*)', replace: '\1\2--container-runtime=remote\4' } | ||
- { regexp: '^(KUBELET_KUBEADM_ARGS=\")(.*)(--container-runtime-endpoint=.*\.sock)(.*)', replace: '\1\2--container-runtime-endpoint=/run/containerd/containerd.sock\4' } | ||
when: kubelet_kubeadmn_args_content.find('--container-runtime') != -1 | ||
|
||
- name: Append container-runtime to kubelet config | ||
replace: | ||
path: /var/lib/kubelet/kubeadm-flags.env | ||
regexp: '^(KUBELET_KUBEADM_ARGS=\")(.*)(\")$' | ||
replace: '\1\2 --container-runtime=remote"' | ||
when: kubelet_kubeadmn_args_content.find('--container-runtime') == -1 | ||
|
||
- name: Append container-runtime-endpoint to kubelet config | ||
replace: | ||
path: /var/lib/kubelet/kubeadm-flags.env | ||
regexp: '^(KUBELET_KUBEADM_ARGS=\")(.*)(\")$' | ||
replace: '\1\2 --container-runtime-endpoint=/run/containerd/containerd.sock"' | ||
when: kubelet_kubeadmn_args_content.find('--container-runtime-endpoint') == -1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters