-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkubeadm-init-config.yaml
127 lines (121 loc) · 4.19 KB
/
kubeadm-init-config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# ------------------------------------InitConfiguration ---------------------------------------------
apiVersion: kubeadm.k8s.io/v1beta2
kind: InitConfiguration
bootstrapTokens:
- token: "9a08jv.c0izixklcxtmnze7"
description: "kubeadm bootstrap token" #初始化集群使用的token
ttl: "24h"
- token: "783bde.3f89s0fje9f38fhf"
description: "another bootstrap token" #用于添加node的token
usages:
- authentication
- signing
groups:
- system:bootstrappers:kubeadm:default-node-token
nodeRegistration:
criSocket: /var/run/dockershim.sock
name: rancher.local
taints:
- effect: NoSchedule
key: node-role.kubernetes.io/master
localAPIEndpoint: # 指定master的监听ip和端口
advertiseAddress: 1.2.3.4
bindPort: 6443
# >> bootstrapTokens :集群初始化需要的token 设置
# >> nodeRegistration :包含集群节点的配置相关字段
# >> LocalAPIEndpoint : API server部署在当前节点的监听地址和端口号
# ------------------------------------ClusterConfiguration --------------------------------------------
apiVersion: kubeadm.k8s.io/v1beta2
kind: ClusterConfiguration
etcd:
# 新建单个etcd或者连接外部etcd集群
local:
imageRepository: "k8s.gcr.io"
imageTag: "3.2.24"
dataDir: "/var/lib/etcd"
extraArgs:
listen-client-urls: "http://10.100.0.1:2379"
serverCertSANs:
- "ec2-10-100-0-1.compute-1.amazonaws.com"
peerCertSANs:
- "10.100.0.1"
# external:
# endpoints:
# - "10.100.0.1:2379"
# - "10.100.0.2:2379"
# caFile: "/etcd/kubernetes/pki/etcd/etcd-ca.crt"
# certFile: "/etcd/kubernetes/pki/etcd/etcd.crt"
# keyFile: "/etcd/kubernetes/pki/etcd/etcd.key"
networking:
# 设置集群网络
serviceSubnet: "10.96.0.0/12"
podSubnet: "10.100.0.1/24"
dnsDomain: "cluster.local"
#集群版本号
kubernetesVersion: "v1.12.0"
#masterip和端口,这里也可以设置域名或者VIP
controlPlaneEndpoint: "10.100.0.1:6443"
apiServer:
extraArgs:
authorization-mode: "Node,RBAC"
extraVolumes:
- name: "some-volume"
hostPath: "/etc/some-path"
mountPath: "/etc/some-pod-path"
readOnly: false
pathType: File
certSANs:
# 设置证书,如果是多个master就把master的ip和主机名写入,还可以配置域名和VIP
- "10.100.1.1"
- "ec2-10-100-0-1.compute-1.amazonaws.com"
timeoutForControlPlane: 4m0s
controllerManager:
extraArgs:
"node-cidr-mask-size": "20"
extraVolumes:
- name: "some-volume"
hostPath: "/etc/some-path"
mountPath: "/etc/some-pod-path"
readOnly: false
pathType: File
scheduler:
extraArgs:
address: "10.100.0.1"
extraVolumes:
- name: "some-volume"
hostPath: "/etc/some-path"
mountPath: "/etc/some-pod-path"
readOnly: false
pathType: File
# 指定证书存放路径
certificatesDir: "/etc/kubernetes/pki"
# 镜像地址
imageRepository: "k8s.gcr.io"
# >> Networking : 集群的网络配置,比如node和 service的子网
# >> Etcd configurations: etcd的相关配置,以及指定自建etcd 集群
# >> kube-apiserver, kube-scheduler, kube-controller-manager : master组件的相关配置
# ------------------------------------KubeletConfiguration --------------------------------------------
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
failSwapOn: false
#禁用swap检测
cgroupDriver: systemd
#修改driver为systemd
rotateCertificates: true
# 开启证书轮询
# ------------------------------------KubeProxyConfiguration -------------------------------------------
apiVersion: kubeproxy.config.k8s.io/v1alpha1
kind: KubeProxyConfiguration
clusterCIDR: "10.244.0.0/16"
# 启用 ipvs 模式
mode: "ipvs"
ipvs:
# 如果node提供lvs服务,排除以下CIDR 不受kube-proxy管理,避免刷掉lvs规则
excludeCIDRs: [1.1.1.0/24,2.2.2.0/24]
minSyncPeriod: 5s
syncPeriod: 5s
# ipvs 负载策略
scheduler: "wrr"
# ------------------------------------更多的配置参数查看官方文档 -------------------------------------------
# https://kubernetes.io/docs/reference/command-line-tools-reference/kube-proxy/
# https://godoc.org/k8s.io/kube-proxy/config/v1alpha1#KubeProxyConfiguration