forked from easzlab/kubeasz
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
212 additions
and
9 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# to install containerd service | ||
- hosts: | ||
- kube-master | ||
- kube-node | ||
roles: | ||
- containerd |
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
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
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
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
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
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,10 @@ | ||
# 容器持久化存储目录 | ||
STORAGE_DIR: "/var/lib/containerd" | ||
|
||
# 基础容器镜像 | ||
SANDBOX_IMAGE: "mirrorgooglecontainers/pause-amd64:3.1" | ||
|
||
# 国内镜像加速 | ||
REG_MIRRORS: | ||
- "https://dockerhub.azk8s.cn" | ||
- "https://docker.mirrors.ustc.edu.cn" |
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,56 @@ | ||
- name: 准备containerd相关目录 | ||
file: name={{ item }} state=directory | ||
with_items: | ||
- "{{ bin_dir }}" | ||
- "/etc/containerd" | ||
|
||
- name: 安装 libseccomp2 | ||
package: name=libseccomp2 state=present | ||
when: ansible_distribution == "Ubuntu" or ansible_distribution == "Debian" | ||
|
||
- name: 安装 libseccomp | ||
package: name=libseccomp state=present | ||
when: ansible_distribution == "CentOS" or ansible_distribution == "RedHat" or ansible_distribution == "Amazon" | ||
|
||
- name: 加载内核模块 overlay | ||
modprobe: name=overlay state=present | ||
|
||
- 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-stress | ||
- crictl | ||
- critest | ||
- ctr | ||
- runc | ||
tags: upgrade | ||
|
||
- name: 创建 containerd 配置文件 | ||
template: src=config.toml.j2 dest=/etc/containerd/config.toml | ||
tags: upgrade | ||
|
||
- name: 创建systemd unit文件 | ||
template: src=containerd.service.j2 dest=/etc/systemd/system/containerd.service | ||
tags: upgrade | ||
|
||
- name: 创建 crictl 配置 | ||
template: src=crictl.yaml.j2 dest=/etc/crictl.yaml | ||
|
||
- name: 开机启用 containerd 服务 | ||
shell: systemctl enable containerd | ||
ignore_errors: true | ||
|
||
- name: 开启 containerd 服务 | ||
shell: systemctl daemon-reload && systemctl restart containerd | ||
tags: upgrade | ||
|
||
- name: 轮询等待containerd服务运行 | ||
shell: "systemctl status containerd.service|grep Active" | ||
register: containerd_status | ||
until: '"running" in containerd_status.stdout' | ||
retries: 8 | ||
delay: 2 | ||
tags: upgrade |
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,81 @@ | ||
root = "{{ STORAGE_DIR }}" | ||
state = "/run/containerd" | ||
oom_score = 0 | ||
|
||
[grpc] | ||
address = "/run/containerd/containerd.sock" | ||
uid = 0 | ||
gid = 0 | ||
max_recv_message_size = 16777216 | ||
max_send_message_size = 16777216 | ||
|
||
[debug] | ||
address = "" | ||
uid = 0 | ||
gid = 0 | ||
level = "" | ||
|
||
[metrics] | ||
address = "" | ||
grpc_histogram = false | ||
|
||
[cgroup] | ||
path = "" | ||
|
||
[plugins] | ||
[plugins.cgroups] | ||
no_prometheus = false | ||
[plugins.cri] | ||
stream_server_address = "127.0.0.1" | ||
stream_server_port = "0" | ||
enable_selinux = false | ||
sandbox_image = "{{ SANDBOX_IMAGE }}" | ||
stats_collect_period = 10 | ||
systemd_cgroup = false | ||
enable_tls_streaming = false | ||
max_container_log_line_size = 16384 | ||
[plugins.cri.containerd] | ||
snapshotter = "overlayfs" | ||
no_pivot = false | ||
[plugins.cri.containerd.default_runtime] | ||
runtime_type = "io.containerd.runtime.v1.linux" | ||
runtime_engine = "" | ||
runtime_root = "" | ||
[plugins.cri.containerd.untrusted_workload_runtime] | ||
runtime_type = "" | ||
runtime_engine = "" | ||
runtime_root = "" | ||
[plugins.cri.cni] | ||
bin_dir = "{{ bin_dir }}" | ||
conf_dir = "/etc/cni/net.d" | ||
conf_template = "" | ||
[plugins.cri.registry] | ||
[plugins.cri.registry.mirrors] | ||
[plugins.cri.registry.mirrors."docker.io"] | ||
endpoint = [ | ||
{% for SITE in REG_MIRRORS %} | ||
"{{ SITE }}", | ||
{% endfor %} | ||
"http://hub-mirror.c.163.com" | ||
] | ||
[plugins.cri.x509_key_pair_streaming] | ||
tls_cert_file = "" | ||
tls_key_file = "" | ||
[plugins.diff-service] | ||
default = ["walking"] | ||
[plugins.linux] | ||
shim = "containerd-shim" | ||
runtime = "runc" | ||
runtime_root = "" | ||
no_shim = false | ||
shim_debug = false | ||
[plugins.opt] | ||
path = "/opt/containerd" | ||
[plugins.restart] | ||
interval = "10s" | ||
[plugins.scheduler] | ||
pause_threshold = 0.02 | ||
deletion_threshold = 0 | ||
mutation_threshold = 100 | ||
schedule_delay = "0s" | ||
startup_delay = "100ms" |
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,21 @@ | ||
[Unit] | ||
Description=containerd container runtime | ||
Documentation=https://containerd.io | ||
After=network.target | ||
|
||
[Service] | ||
Environment="PATH={{ bin_dir }}:/bin:/sbin:/usr/bin:/usr/sbin" | ||
ExecStart={{ bin_dir }}/containerd | ||
Restart=always | ||
RestartSec=5 | ||
Delegate=yes | ||
KillMode=process | ||
OOMScoreAdjust=-999 | ||
LimitNOFILE=1048576 | ||
# Having non-zero Limit*s causes performance problems due to accounting overhead | ||
# in the kernel. We recommend using cgroups to do container-local accounting. | ||
LimitNPROC=infinity | ||
LimitCORE=infinity | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
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 @@ | ||
runtime-endpoint: unix:///run/containerd/containerd.sock |
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
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