forked from easzlab/kubeasz
-
Notifications
You must be signed in to change notification settings - Fork 1
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
17 changed files
with
158 additions
and
32 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,45 @@ | ||
# 清理集群docker服务、网络相关 | ||
- hosts: | ||
- kube-master | ||
- new-master | ||
- kube-node | ||
- new-node | ||
tasks: | ||
- name: 清理目录和文件 | ||
file: name={{ item }} state=absent | ||
with_items: | ||
- "/etc/cni/" | ||
- "/run/flannel/" | ||
- "/var/lib/cni/" | ||
|
||
- name: 清理 iptables | ||
shell: "iptables -F && iptables -X \ | ||
&& iptables -F -t nat && iptables -X -t nat \ | ||
&& iptables -F -t raw && iptables -X -t raw \ | ||
&& iptables -F -t mangle && iptables -X -t mangle" | ||
|
||
- name: 清理网络 | ||
shell: "ip link del tunl0; \ | ||
ip link del flannel.1; \ | ||
ip link del cni0; \ | ||
ip link del mynet0; \ | ||
systemctl restart networking; \ | ||
systemctl restart network; \ | ||
systemctl restart docker" | ||
ignore_errors: true | ||
# 清理负载均衡相关 | ||
- hosts: lb | ||
tasks: | ||
- name: stop keepalived service | ||
shell: systemctl disable keepalived && systemctl stop keepalived | ||
ignore_errors: true | ||
|
||
- name: stop haproxy service | ||
shell: systemctl disable haproxy && systemctl stop haproxy | ||
ignore_errors: true | ||
|
||
- name: 清理LB 配置文件目录 | ||
file: name={{ item }} state=absent | ||
with_items: | ||
- "/etc/haproxy" | ||
- "/etc/keepalived" |
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,2 @@ | ||
# linux系统 | ||
- [systemctl替代service与chkconfig](https://blog.csdn.net/itcomputer12/article/details/41799139) |
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,18 @@ | ||
{ | ||
"registry-mirrors": ["https://kuamavit.mirror.aliyuncs.com", "https://registry.docker-cn.com", "https://docker.mirrors.ustc.edu.cn"], | ||
"insecure-registries":["http://harbor.oceanai.com.cn"], | ||
"max-concurrent-downloads": 10, | ||
"log-driver": "json-file", | ||
"log-level": "warn", | ||
"log-opts": { | ||
"max-size": "10m", | ||
"max-file": "3" | ||
}, | ||
"runtimes": { | ||
"nvidia": { | ||
"path": "/usr/bin/nvidia-container-runtime", | ||
"runtimeArgs": [] | ||
} | ||
}, | ||
"default-runtime": "nvidia" | ||
} |
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 |
---|---|---|
@@ -1,19 +1,38 @@ | ||
[Unit] | ||
Description=Docker Application Container Engine | ||
Documentation=http://docs.docker.io | ||
Documentation=https://docs.docker.com | ||
After=network-online.target docker.socket firewalld.service | ||
Wants=network-online.target | ||
Requires=docker.socket | ||
|
||
[Service] | ||
Environment="PATH={{ bin_dir }}:/bin:/sbin:/usr/bin:/usr/sbin" | ||
ExecStart={{ bin_dir }}/dockerd | ||
Type=notify | ||
#EnvironmentFile=-/etc/default/docker | ||
# the default is not to use systemd for cgroups because the delegate issues still | ||
# exists and systemd currently does not support the cgroup feature set required | ||
# for containers run by docker | ||
ExecStart=/usr/bin/dockerd -H fd:// | ||
ExecStartPost=/sbin/iptables -I FORWARD -s 0.0.0.0/0 -j ACCEPT | ||
ExecReload=/bin/kill -s HUP $MAINPID | ||
Restart=on-failure | ||
RestartSec=5 | ||
LimitNOFILE=infinity | ||
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 | ||
# Uncomment TasksMax if your systemd version supports it. | ||
# Only systemd 226 and above support this version. | ||
TasksMax=infinity | ||
TimeoutStartSec=0 | ||
# set delegate yes so that systemd does not reset the cgroups of docker containers | ||
Delegate=yes | ||
# kill only the docker process, not all processes in the cgroup | ||
KillMode=process | ||
# restart the docker process if it exits prematurely | ||
Restart=on-failure | ||
RestartSec=5 | ||
StartLimitBurst=3 | ||
StartLimitInterval=60s | ||
TimeoutSec=300 | ||
|
||
[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
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,20 @@ | ||
echo "***1. shutdown etcd***" | ||
echo | ||
ansible all -m shell -a "systemctl stop etcd" | ||
|
||
echo "***2. shutdown kube-apiserver***" | ||
echo | ||
ansible all -m shell -a "systemctl stop kube-apiserver" | ||
echo "***3. shutdown kube-controller-manager***" | ||
echo | ||
ansible all -m shell -a "systemctl stop kube-controller-manager" | ||
echo "***4. shutdown kube-scheduler***" | ||
echo | ||
ansible all -m shell -a "systemctl stop kube-scheduler" | ||
echo "***5. shutdown kube-apiserver***" | ||
echo | ||
ansible all -m shell -a "systemctl stop kube-proxy" | ||
echo "***6. shutdown kubelet***" | ||
echo | ||
ansible all -m shell -a "systemctl stop kubelet" | ||
|
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,20 @@ | ||
echo "***1. start etcd***" | ||
echo | ||
ansible all -m shell -a "systemctl daemon-reload && systemctl restart etcd" | ||
|
||
echo "***2. start kube-apiserver***" | ||
echo | ||
ansible all -m shell -a "systemctl daemon-reload && systemctl restart kube-apiserver" | ||
echo "***3. start kube-controller-manager***" | ||
echo | ||
ansible all -m shell -a "systemctl daemon-reload && systemctl restart kube-controller-manager" | ||
echo "***4. start kube-scheduler***" | ||
echo | ||
ansible all -m shell -a "systemctl daemon-reload && systemctl restart kube-scheduler" | ||
echo "***5. start kube-apiserver***" | ||
echo | ||
ansible all -m shell -a "systemctl daemon-reload && systemctl restart kube-proxy" | ||
echo "***6. start kubelet***" | ||
echo | ||
ansible all -m shell -a "systemctl daemon-reload && systemctl restart kubelet" | ||
|
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 @@ | ||
kubectl run test --image=busybox --replicas=3 sleep 30000 |