@@ -92,17 +92,6 @@ items:
92
92
# kubeadm uses 10th IP as DNS server
93
93
CLUSTER_DNS_SERVER=$(prips ${SERVICE_CIDR} | head -n 11 | tail -n 1)
94
94
95
- # add cloud provider args.
96
- touch /etc/systemd/system/kubelet.service.d/20-kubelet.conf
97
- cat > /etc/systemd/system/kubelet.service.d/20-kubelet.conf <<EOF
98
- [Service]
99
- Environment="KUBELET_NETWORK_ARGS=--network-plugin=cni"
100
- Environment="KUBELET_DNS_ARGS=--resolv-conf=/run/systemd/resolve/resolv.conf --cluster-dns=${CLUSTER_DNS_SERVER} --cluster-domain=${CLUSTER_DNS_DOMAIN} --node-ip=${PRIVATEIP}"
101
- Environment="KUBELET_EXTRA_ARGS=--allow-privileged=true --cloud-provider=external --authentication-token-webhook=true --read-only-port=0"
102
- EOF
103
- systemctl daemon-reload
104
- systemctl restart kubelet.service
105
-
106
95
function install_custom_ca () {
107
96
if [ ! -n "$MASTER_CA_CERTIFICATE" ]; then
108
97
return
@@ -137,6 +126,15 @@ items:
137
126
bindPort : ${PORT}
138
127
nodeRegistration :
139
128
name : ${HOSTNAME}
129
+ kubeletExtraArgs :
130
+ # resolv-conf: /run/systemd/resolve/resolv.conf
131
+ cluster-dns : ${CLUSTER_DNS_SERVER}
132
+ cluster-domain : ${CLUSTER_DNS_DOMAIN}
133
+ node-ip : ${PRIVATEIP}
134
+ allow-privileged : " true"
135
+ cloud-provider : external
136
+ authentication-token-webhook : " true"
137
+ read-only-port : " 0"
140
138
---
141
139
apiVersion : kubeadm.k8s.io/v1beta1
142
140
kind : ClusterConfiguration
@@ -167,6 +165,23 @@ items:
167
165
sleep 1
168
166
done
169
167
else
168
+ touch /etc/kubernetes/kubeadm_config.yaml
169
+ cat > /etc/kubernetes/kubeadm_config.yaml <<EOF
170
+ apiVersion : kubeadm.k8s.io/v1beta1
171
+ kind : JoinConfiguration
172
+ nodeRegistration :
173
+ name : ${HOSTNAME}
174
+ kubeletExtraArgs :
175
+ # resolv-conf: /run/systemd/resolve/resolv.conf
176
+ cluster-dns : ${CLUSTER_DNS_SERVER}
177
+ cluster-domain : ${CLUSTER_DNS_DOMAIN}
178
+ node-ip : ${PRIVATEIP}
179
+ allow-privileged : " true"
180
+ cloud-provider : external
181
+ authentication-token-webhook : " true"
182
+ read-only-port : " 0"
183
+ EOF
184
+
170
185
export ENDPOINT=''
171
186
if [ -n "$MASTER_PRIVATE" ]; then
172
187
export ENDPOINT=$MASTER_PRIVATE
0 commit comments