mirror of https://github.com/easzlab/kubeasz.git
调整集群内api服务地址和dns服务地址设置方式
parent
452c79e42e
commit
a5ab2d94a0
|
@ -3,15 +3,6 @@
|
|||
register: pod_info
|
||||
tags: force_change_certs
|
||||
|
||||
- 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 or CHANGE_CA|bool'
|
||||
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
# default values
|
||||
|
||||
# coredns 服务地址,根据SERVICE_CIDR 设置,默认选择网段第二个地址
|
||||
CLUSTER_DNS_SVC_IP: "{{ SERVICE_CIDR.split('.')[0] }}.{{ SERVICE_CIDR.split('.')[1] }}.{{ SERVICE_CIDR.split('.')[2] }}.{{ SERVICE_CIDR.split('.')[3]|int + 2 }}"
|
||||
|
|
|
@ -14,15 +14,6 @@
|
|||
- kube-scheduler.kubeconfig
|
||||
tags: force_change_certs
|
||||
|
||||
- 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, force_change_certs
|
||||
|
||||
- name: 设置变量 CLUSTER_KUBERNETES_SVC_IP
|
||||
set_fact: CLUSTER_KUBERNETES_SVC_IP={{ KUBERNETES_SVC_IP.stdout }}
|
||||
tags: change_cert, force_change_certs
|
||||
|
||||
- name: 创建 kubernetes 证书签名请求
|
||||
template: src=kubernetes-csr.json.j2 dest={{ cluster_dir }}/ssl/kubernetes-csr.json
|
||||
tags: change_cert, force_change_certs
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# etcd 集群服务地址列表, 根据etcd组成员自动生成
|
||||
TMP_ENDPOINTS: "{% for h in groups['etcd'] %}https://{{ h }}:2379,{% endfor %}"
|
||||
ETCD_ENDPOINTS: "{{ TMP_ENDPOINTS.rstrip(',') }}"
|
||||
|
||||
# kubernetes.default.svc 地址根据SERVICE_CIDR 设置为网段的第一个地址
|
||||
CLUSTER_KUBERNETES_SVC_IP: "{{ SERVICE_CIDR.split('.')[0] }}.{{ SERVICE_CIDR.split('.')[1] }}.{{ SERVICE_CIDR.split('.')[2] }}.{{ SERVICE_CIDR.split('.')[3]|int + 1 }}"
|
||||
|
|
|
@ -23,13 +23,6 @@
|
|||
- 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
|
||||
|
|
|
@ -3,3 +3,6 @@ KUBE_APISERVER: "https://127.0.0.1:{{ SECURE_PORT }}"
|
|||
|
||||
# cgroup driver
|
||||
CGROUP_DRIVER: "systemd"
|
||||
|
||||
# coredns 服务地址,根据SERVICE_CIDR 设置,默认选择网段第二个地址
|
||||
CLUSTER_DNS_SVC_IP: "{{ SERVICE_CIDR.split('.')[0] }}.{{ SERVICE_CIDR.split('.')[1] }}.{{ SERVICE_CIDR.split('.')[2] }}.{{ SERVICE_CIDR.split('.')[3]|int + 2 }}"
|
||||
|
|
Loading…
Reference in New Issue