Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

优化ntp和tar包位置 #23

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ k8s-node
[all:vars]
vip=10.1.86.209 # 同网段未被占用IP
k8s_version=1.12.0 # kubernetes版本
need_ntp=true #是否安装ntp
tar_local=/data #k8s安装目录
etcd_image=k8s.gcr.io/etcd:3.2.24 #镜像名称
haproxy_image=haproxy:1.7
keepalived_image=fanux/keepalived:2.0.8
calico_node_image=quay.io/calico/node:v3.2.2
calico_cni_image=quay.io/calico/cni:v3.2.2
calico_controller_image=quay.io/calico/kube-controllers:v3.2.2
ip_interface=eth.*
etcd_crts=["ca-key.pem","ca.pem","client-key.pem","client.pem","member1-key.pem","member1.pem","server-key.pem","server.pem","ca.csr","client.csr","member1.csr","server.csr"]
k8s_crts=["apiserver.crt","apiserver-kubelet-client.crt","ca.crt", "front-proxy-ca.key","front-proxy-client.key","sa.pub", "apiserver.key","apiserver-kubelet-client.key", "ca.key", "front-proxy-ca.crt", "front-proxy-client.crt" , "sa.key"]
Expand Down
8 changes: 8 additions & 0 deletions hosts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ k8s-node
[all:vars]
vip=10.1.86.209
k8s_version=1.12.2
need_ntp=true
tar_local=/data
etcd_image=k8s.gcr.io/etcd:3.2.24
haproxy_image=haproxy:1.7
keepalived_image=fanux/keepalived:2.0.8
calico_node_image=quay.io/calico/node:v3.2.2
calico_cni_image=quay.io/calico/cni:v3.2.2
calico_controller_image=quay.io/calico/kube-controllers:v3.2.2
ip_interface=eth.*
etcd_crts=["ca-key.pem","ca.pem","client-key.pem","client.pem","member1-key.pem","member1.pem","server-key.pem","server.pem","ca.csr","client.csr","member1.csr","server.csr"]
k8s_crts=["apiserver.crt","apiserver-kubelet-client.crt","ca.crt", "front-proxy-ca.key","front-proxy-client.key","sa.pub", "apiserver.key","apiserver-kubelet-client.key", "ca.key", "front-proxy-ca.crt", "front-proxy-client.crt" , "sa.key"]
9 changes: 7 additions & 2 deletions roles/base/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@
# - quay.io/calico/kube-controllers:v3.2.0

- name: copy kubernetes.tar.gz
copy: 'src=/data/kube{{ k8s_version }}.tar.gz dest=/root/ mode=0644'
copy: 'src={{ tar_local }}/kube{{ k8s_version }}.tar.gz dest=/root/ mode=0644'

- name: init every node
shell: 'cd /root && {{ item }}'
with_items:
- tar zxvf kube{{ k8s_version }}.tar.gz
- cd kube/shell && sh init.sh

- name: ntp config
shell: '{{ item }}'
with_items:
- yum install ntpdate -y
- ntpdate 0.asia.pool.ntp.org
- ntpdate 0.asia.pool.ntp.org
when: ( need_ntp == 'true' )
2 changes: 1 addition & 1 deletion roles/etcd/templates/etcd.static-pod.j2
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
- --peer-trusted-ca-file=/etc/kubernetes/pki/etcd/ca.pem
- --snapshot-count=10000
- --trusted-ca-file=/etc/kubernetes/pki/etcd/ca.pem
image: k8s.gcr.io/etcd:3.2.24
image: {{ etcd_image }}
imagePullPolicy: IfNotPresent
livenessProbe:
exec:
Expand Down
2 changes: 1 addition & 1 deletion roles/haproxy/templates/haproxy.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ metadata:
namespace: kube-system
spec:
containers:
- image: haproxy:1.7
- image: {{ haproxy_image }}
imagePullPolicy: IfNotPresent
name: haproxy
volumeMounts:
Expand Down
2 changes: 1 addition & 1 deletion roles/install-dashboard.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
- hosts: k8s-master
roles:
- { role: kube-dashboard, when: lb is defined }
- { role: kube-dashboard, when: lb is defined }
2 changes: 1 addition & 1 deletion roles/keepalived/templates/keepalived.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ metadata:
namespace: kube-system
spec:
containers:
- image: fanux/keepalived:2.0.8
- image: {{ keepalived_image }}
imagePullPolicy: IfNotPresent
name: keepalived
securityContext:
Expand Down
2 changes: 1 addition & 1 deletion roles/kube-dashboard/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
- kubectl delete secret -n kube-system kubernetes-dashboard-certs
- kubectl create secret generic kubernetes-dashboard-certs --from-file=/root/certs -n kube-system
- systemctl restart kubelet.service
when: ( order is defined ) and ( order == 1 )
when: ( order is defined ) and ( order == 1 )
6 changes: 3 additions & 3 deletions roles/kube-master/templates/calico.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ spec:
# container programs network policy and routes on each
# host.
- name: calico-node
image: quay.io/calico/node:v3.2.2
image: {{ calico_node_image }}
env:
# The location of the Calico etcd cluster.
- name: ETCD_ENDPOINTS
Expand Down Expand Up @@ -220,7 +220,7 @@ spec:
# This container installs the Calico CNI binaries
# and CNI network config file on each node.
- name: install-cni
image: quay.io/calico/cni:v3.2.2
image: {{ calico_cni_image }}
command: ["/install-cni.sh"]
env:
# Name of the CNI config file to create.
Expand Down Expand Up @@ -319,7 +319,7 @@ spec:
serviceAccountName: calico-kube-controllers
containers:
- name: calico-kube-controllers
image: quay.io/calico/kube-controllers:v3.2.2
image: {{ calico_controller_image }}
env:
# The location of the Calico etcd cluster.
- name: ETCD_ENDPOINTS
Expand Down