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 # to install clust-addons
- hosts: - hosts: localhost
- kube_node
roles: roles:
- cluster-addon - cluster-addon

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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