modify to run 'cluster-addon' setup on ansible host

dev3
gjmzj 2022-11-26 15:19:16 +08:00
parent 64d177aaea
commit 02bd98b18e
13 changed files with 55 additions and 77 deletions

View File

@ -1,5 +1,4 @@
# to install clust-addons
- hosts:
- kube_node
- hosts: localhost
roles:
- cluster-addon

View File

@ -71,7 +71,6 @@
- { role: kube-ovn, when: "CLUSTER_NETWORK == 'kube-ovn'" }
# to install cluster-addons
- hosts:
- kube_node
- hosts: localhost
roles:
- cluster-addon

View File

@ -41,7 +41,6 @@
- { role: kube-ovn, when: "CLUSTER_NETWORK == 'kube-ovn'" }
# to install cluster-addons
- hosts:
- kube_node
- hosts: localhost
roles:
- cluster-addon

View File

@ -29,5 +29,4 @@
- debug:
msg: "[重要]: 请查看命名空间cilium-test下所有pod如果均为Running状态且没有重启数增长说明cilium连接测试正常。 \
测试观察一段时间可以整体删除该命名空间所有资源(kubectl delete ns cilium-test)"
run_once: true
connection: local
when: 'cilium_connectivity_check|bool'

View File

@ -1,9 +1,7 @@
- name: 准备 DNS的部署文件
- block:
- name: 准备 DNS的部署文件
template: src=dns/coredns.yaml.j2 dest={{ cluster_dir }}/yml/coredns.yaml
run_once: true
connection: local
- name: 创建coredns部署
- name: 创建coredns部署
shell: "{{ base_dir }}/bin/kubectl apply -f {{ cluster_dir }}/yml/coredns.yaml"
run_once: true
connection: local
when: 'dns_install == "yes"'

View File

@ -1,18 +1,14 @@
- name: prepare some dirs
- block:
- name: prepare some dirs
file: name={{ cluster_dir }}/yml/dashboard state=directory
run_once: true
connection: local
- name: 准备 dashboard的部署文件
- name: 准备 dashboard的部署文件
template: src=dashboard/{{ item }}.j2 dest={{ cluster_dir }}/yml/dashboard/{{ item }}
with_items:
- "kubernetes-dashboard.yaml"
- "admin-user-sa-rbac.yaml"
- "read-user-sa-rbac.yaml"
run_once: true
connection: local
- name: 创建 dashboard部署
- name: 创建 dashboard部署
shell: "{{ base_dir }}/bin/kubectl apply -f {{ cluster_dir }}/yml/dashboard/"
run_once: true
connection: local
when: 'dashboard_install == "yes"'

View File

@ -1,8 +1,6 @@
- name: 获取所有已经创建的POD信息
command: "{{ base_dir }}/bin/kubectl get pod --all-namespaces"
register: pod_info
connection: local
run_once: true
- name: 注册变量 DNS_SVC_IP
shell: echo {{ SERVICE_CIDR }}|cut -d/ -f1|awk -F. '{print $1"."$2"."$3"."$4+2}'
@ -32,7 +30,7 @@
when: '"nfs-client-provisioner" not in pod_info.stdout and nfs_provisioner_install == "yes"'
- import_tasks: cilium_connectivity_check.yml
when: 'CLUSTER_NETWORK == "cilium" and cilium_connectivity_check|bool'
when: 'CLUSTER_NETWORK == "cilium"'
- import_tasks: network_check.yml
when: 'network_check_enabled|bool and CLUSTER_NETWORK != "cilium"'

View File

@ -1,10 +1,7 @@
- name: 准备 metrics-server的部署文件
- block:
- name: 准备 metrics-server的部署文件
template: src=metrics-server/components.yaml.j2 dest={{ cluster_dir }}/yml/metrics-server.yaml
run_once: true
connection: local
- name: 创建 metrics-server部署
- name: 创建 metrics-server部署
shell: "{{ base_dir }}/bin/kubectl apply -f {{ cluster_dir }}/yml/metrics-server.yaml"
run_once: true
connection: local
when: 'metricsserver_install == "yes"'

View File

@ -17,5 +17,4 @@
- debug:
msg: "[重要]: 请查看命名空间network-test下所有pod如果均为Completed状态且没有重启数增长说明网络连接测试正常。 \
如果有Pending状态部分测试需要多节点集群才能完成如果希望禁用网络测试执行(kubectl delete ns network-test)"
run_once: true
connection: local
when: 'network_check_enabled|bool'

View File

@ -1,17 +1,13 @@
- name: 准备 nfs-provisioner 配置目录
- block:
- name: 准备 nfs-provisioner 配置目录
file: name={{ cluster_dir }}/yml/nfs-provisioner state=directory
run_once: true
connection: local
- name: 准备 nfs-provisioner部署文件
- name: 准备 nfs-provisioner部署文件
template: src=nfs-provisioner/{{ item }}.j2 dest={{ cluster_dir }}/yml/nfs-provisioner/{{ item }}
with_items:
- "nfs-provisioner.yaml"
- "test-pod.yaml"
run_once: true
connection: local
- name: 创建 nfs-provisioner部署
- name: 创建 nfs-provisioner部署
shell: "{{ base_dir }}/bin/kubectl apply -f {{ cluster_dir }}/yml/nfs-provisioner/nfs-provisioner.yaml"
run_once: true
connection: local
when: 'nfs_provisioner_install == "yes"'

View File

@ -1,16 +1,12 @@
- name: 准备dnscache的部署文件
- block:
- name: 准备dnscache的部署文件
template: src=dns/nodelocaldns-ipvs.yaml.j2 dest={{ cluster_dir }}/yml/nodelocaldns.yaml
when: "PROXY_MODE == 'ipvs'"
run_once: true
connection: local
- name: 准备dnscache的部署文件
- name: 准备dnscache的部署文件
template: src=dns/nodelocaldns-iptables.yaml.j2 dest={{ cluster_dir }}/yml/nodelocaldns.yaml
when: "PROXY_MODE == 'iptables'"
run_once: true
connection: local
- name: 创建dnscache部署
- name: 创建dnscache部署
shell: "{{ base_dir }}/bin/kubectl apply -f {{ cluster_dir }}/yml/nodelocaldns.yaml"
run_once: true
connection: local
when: 'ENABLE_LOCAL_DNS_CACHE|bool'

View File

@ -42,5 +42,4 @@
shell: "{{ base_dir }}/bin/helm upgrade prometheus --install \
-n {{ prom_namespace }} -f {{ cluster_dir }}/yml/prom-values.yaml \
{{ base_dir }}/roles/cluster-addon/files/kube-prometheus-stack-{{ prom_chart_ver }}.tgz"
run_once: true
connection: local
when: 'prom_install == "yes"'

View File

@ -1 +1,4 @@
# default values
# CHANGE_CA: when set true, force to change ca certs
CHANGE_CA: false