remove dependency: netaddr

pull/992/head
gjmzj 2021-01-22 23:54:12 +08:00
parent f0aaad4b0f
commit 7dd8fd9fbb
10 changed files with 33 additions and 17 deletions

View File

@ -63,7 +63,7 @@ apt-get install git python-pip -y
yum install git python-pip -y
# pip安装ansible(国内如果安装太慢可以直接用pip阿里云加速)
pip install pip --upgrade -i https://mirrors.aliyun.com/pypi/simple/
pip install ansible netaddr==0.7.19 -i https://mirrors.aliyun.com/pypi/simple/
pip install ansible -i https://mirrors.aliyun.com/pypi/simple/
```
- 3.2 在ansible控制端配置免密码登录

View File

@ -10,6 +10,15 @@
connection: local
run_once: true
- name: 注册变量 DNS_SVC_IP
shell: echo {{ SERVICE_CIDR }}|cut -d/ -f1|awk -F. '{print $1"."$2"."$3"."$4+2}'
register: DNS_SVC_IP
- name: 设置变量 CLUSTER_DNS_SVC_IP
set_fact: CLUSTER_DNS_SVC_IP={{ DNS_SVC_IP.stdout }}
- debug: var="CLUSTER_DNS_SVC_IP"
- import_tasks: coredns.yml
when: '"coredns" not in pod_info.stdout and dns_install == "yes"'

View File

@ -1,6 +1,3 @@
# 设置 dns svc ip (这里选用 SERVICE_CIDR 中第2个IP)
CLUSTER_DNS_SVC_IP: "{{ SERVICE_CIDR | ipaddr('net') | ipaddr(2) | ipaddr('address') }}"
#
coredns_offline: "coredns_{{ corednsVer }}.tar"

View File

@ -78,9 +78,3 @@
line: 'source <(kubectl completion bash)'
when: "procs.stdout|int > 50"
ignore_errors: true
- name: pip install netaddr
pip:
name: netaddr
when: "procs.stdout|int > 50"
ignore_errors: true

View File

@ -7,6 +7,15 @@
- kubectl
tags: upgrade_k8s
- name: 注册变量 KUBERNETES_SVC_IP
shell: echo {{ SERVICE_CIDR }}|cut -d/ -f1|awk -F. '{print $1"."$2"."$3"."$4+1}'
register: KUBERNETES_SVC_IP
tags: change_cert
- name: 设置变量 CLUSTER_KUBERNETES_SVC_IP
set_fact: CLUSTER_KUBERNETES_SVC_IP={{ KUBERNETES_SVC_IP.stdout }}
tags: change_cert
- name: 创建 kubernetes 证书签名请求
template: src=kubernetes-csr.json.j2 dest={{ cluster_dir }}/ssl/kubernetes-csr.json
tags: change_cert

View File

@ -1,6 +1,3 @@
# etcd 集群服务地址列表, 根据etcd组成员自动生成
TMP_ENDPOINTS: "{% for h in groups['etcd'] %}https://{{ h }}:2379,{% endfor %}"
ETCD_ENDPOINTS: "{{ TMP_ENDPOINTS.rstrip(',') }}"
# 设置 dns svc ip (这里选用 SERVICE_CIDR 中第1个IP)
CLUSTER_KUBERNETES_SVC_IP: "{{ SERVICE_CIDR | ipaddr('net') | ipaddr(1) | ipaddr('address') }}"

View File

@ -33,6 +33,13 @@
- name: 准备 cni配置文件
template: src=cni-default.conf.j2 dest=/etc/cni/net.d/10-default.conf
- name: 注册变量 DNS_SVC_IP
shell: echo {{ SERVICE_CIDR }}|cut -d/ -f1|awk -F. '{print $1"."$2"."$3"."$4+2}'
register: DNS_SVC_IP
- name: 设置变量 CLUSTER_DNS_SVC_IP
set_fact: CLUSTER_DNS_SVC_IP={{ DNS_SVC_IP.stdout }}
- name: 创建kubelet的配置文件
template: src=kubelet-config.yaml.j2 dest=/var/lib/kubelet/config.yaml
tags: upgrade_k8s, restart_node

View File

@ -1,6 +1,3 @@
# 设置 dns svc ip (这里选用 SERVICE_CIDR 中第2个IP)
CLUSTER_DNS_SVC_IP: "{{ SERVICE_CIDR | ipaddr('net') | ipaddr(2) | ipaddr('address') }}"
# 设置 APISERVER 地址
KUBE_APISERVER: "{%- if inventory_hostname in groups['kube_master'] -%} \
https://{{ inventory_hostname }}:6443 \

View File

@ -5,6 +5,13 @@
- /opt/kube/images
- /opt/kube/kube-ovn
- name: 注册变量 ovn_default_gateway
shell: echo {{ CLUSTER_CIDR }}|cut -d/ -f1|awk -F. '{print $1"."$2"."$3"."$4+1}'
register: ovn_default_gateway
- name: 设置变量 kube_ovn_default_gateway
set_fact: kube_ovn_default_gateway={{ ovn_default_gateway.stdout }}
- name: 配置 crd.yaml 文件
template: src=crd.yaml.j2 dest=/opt/kube/kube-ovn/crd.yaml

View File

@ -1,4 +1,3 @@
kube_ovn_default_cidr: "{{ CLUSTER_CIDR }}"
kube_ovn_default_gateway: "{{ CLUSTER_CIDR | ipaddr('net') | ipaddr(1) | ipaddr('address') }}"
kube_ovn_node_switch_cidr: 100.64.0.0/16
kube_ovn_enable_mirror: true