From bbed72b9f396c5c9ad601fc133dc1ef2dce3acb2 Mon Sep 17 00:00:00 2001 From: gjmzj Date: Mon, 26 Apr 2021 10:02:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=AE=B9=E5=99=A8=E5=8C=96aio=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E6=97=B6=E9=80=89=E6=8B=A9containerd=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E6=97=B6=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/release-notes/kubeasz-3.1.0.md | 2 + roles/containerd/tasks/main.yml | 101 +++++++++++++++------------- 2 files changed, 56 insertions(+), 47 deletions(-) diff --git a/docs/release-notes/kubeasz-3.1.0.md b/docs/release-notes/kubeasz-3.1.0.md index ea1638b..3d86e7e 100644 --- a/docs/release-notes/kubeasz-3.1.0.md +++ b/docs/release-notes/kubeasz-3.1.0.md @@ -42,6 +42,8 @@ https://www.toutiao.com/c/user/token/MS4wLjABAAAA0YFomuMNm87NNysXeUsQdI0Tt3gOgz8 - fix:restart ex-lb when master nodes change - fix:多条默认路由网卡自动识别问题 - fix:安装aio集群时docker cgroupdriver设置问题 +- fix:add scheme:https to service-account-issuer +- fix:容器化aio安装时选择containerd运行时失败 - feat:增加可选配置apiserver安全端口 - feat:允许修改配置ingress port #999 - feat:增加支持ubuntu 20.04 diff --git a/roles/containerd/tasks/main.yml b/roles/containerd/tasks/main.yml index 91531f4..dbd10f3 100644 --- a/roles/containerd/tasks/main.yml +++ b/roles/containerd/tasks/main.yml @@ -2,61 +2,68 @@ shell: 'systemctl status docker|grep Active || echo "NOT FOUND"' register: docker_status -- name: 停止docker - shell: 'systemctl stop docker' +- name: WARNNING 提示 + debug: + msg: "[WARN]: docker is running, and containerd will be installed" when: '"running" in docker_status.stdout' -- name: 准备containerd相关目录 - file: name={{ item }} state=directory - with_items: - - "{{ bin_dir }}" - - "/etc/containerd" +- name: 获取是否已经安装containerd + shell: 'systemctl status containerd|grep Active || echo "NoFound"' + register: containerd_svc -- name: 加载内核模块 overlay - modprobe: name=overlay state=present +- block: + - name: 准备containerd相关目录 + file: name={{ item }} state=directory + with_items: + - "{{ bin_dir }}" + - "/etc/containerd" -- name: 下载 containerd 二进制文件 - copy: src={{ base_dir }}/bin/containerd-bin/{{ item }} dest={{ bin_dir }}/{{ item }} mode=0755 - with_items: - - containerd - - containerd-shim - - containerd-shim-runc-v1 - - containerd-shim-runc-v2 - - crictl - - ctr - - runc - tags: upgrade + - name: 加载内核模块 overlay + modprobe: name=overlay state=present -- name: 创建 containerd 配置文件 - template: src=config.toml.j2 dest=/etc/containerd/config.toml - tags: upgrade + - name: 下载 containerd 二进制文件 + copy: src={{ base_dir }}/bin/containerd-bin/{{ item }} dest={{ bin_dir }}/{{ item }} mode=0755 + with_items: + - containerd + - containerd-shim + - containerd-shim-runc-v1 + - containerd-shim-runc-v2 + - crictl + - ctr + - runc + tags: upgrade -- name: 创建systemd unit文件 - template: src=containerd.service.j2 dest=/etc/systemd/system/containerd.service - tags: upgrade + - name: 创建 containerd 配置文件 + template: src=config.toml.j2 dest=/etc/containerd/config.toml + tags: upgrade -- name: 创建 crictl 配置 - template: src=crictl.yaml.j2 dest=/etc/crictl.yaml + - name: 创建systemd unit文件 + template: src=containerd.service.j2 dest=/etc/systemd/system/containerd.service + tags: upgrade -- name: 开机启用 containerd 服务 - shell: systemctl enable containerd - ignore_errors: true + - name: 创建 crictl 配置 + template: src=crictl.yaml.j2 dest=/etc/crictl.yaml -- name: 开启 containerd 服务 - shell: systemctl daemon-reload && systemctl restart containerd - tags: upgrade + - name: 开机启用 containerd 服务 + shell: systemctl enable containerd + ignore_errors: true -- name: 轮询等待containerd服务运行 - shell: "systemctl status containerd.service|grep Active" - register: containerd_status - until: '"running" in containerd_status.stdout' - retries: 8 - delay: 2 - tags: upgrade + - name: 开启 containerd 服务 + shell: systemctl daemon-reload && systemctl restart containerd + tags: upgrade -- name: 添加 crictl 命令自动补全 - lineinfile: - dest: ~/.bashrc - state: present - regexp: 'crictl completion' - line: 'source <(crictl completion)' + - name: 轮询等待containerd服务运行 + shell: "systemctl status containerd.service|grep Active" + register: containerd_status + until: '"running" in containerd_status.stdout' + retries: 8 + delay: 2 + tags: upgrade + + - name: 添加 crictl 命令自动补全 + lineinfile: + dest: ~/.bashrc + state: present + regexp: 'crictl completion' + line: 'source <(crictl completion)' + when: "'running' not in containerd_svc.stdout"