Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
6d7c5e90
Commit
6d7c5e90
authored
Nov 13, 2018
by
Pavithra Ramesh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed .salt template , using .sed template
Removed default config options from yaml. Removed unused yaml files
parent
73b548db
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
21 additions
and
408 deletions
+21
-408
Makefile
cluster/addons/dns/nodelocaldns/Makefile
+0
-34
nodelocaldns.yaml
cluster/addons/dns/nodelocaldns/nodelocaldns.yaml
+7
-13
nodelocaldns.yaml.in
cluster/addons/dns/nodelocaldns/nodelocaldns.yaml.in
+0
-150
nodelocaldns.yaml.sed
cluster/addons/dns/nodelocaldns/nodelocaldns.yaml.sed
+0
-150
transforms2salt.sed
cluster/addons/dns/nodelocaldns/transforms2salt.sed
+0
-4
transforms2sed.sed
cluster/addons/dns/nodelocaldns/transforms2sed.sed
+0
-4
config-default.sh
cluster/centos/config-default.sh
+0
-2
deployAddons.sh
cluster/centos/deployAddons.sh
+2
-27
util.sh
cluster/centos/util.sh
+0
-5
configure-helper.sh
cluster/gce/gci/configure-helper.sh
+5
-6
local-up-cluster.sh
hack/local-up-cluster.sh
+7
-13
No files found.
cluster/addons/dns/nodelocaldns/Makefile
deleted
100644 → 0
View file @
73b548db
# Copyright 2018 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Makefile for the kubedns underscore templates to Salt/Pillar and other formats.
# If you update the *.base templates, please run this Makefile before pushing.
#
# Usage:
# make
all
:
transform
# .base -> .in pattern rule
%.in
:
%.base
sed
-f
transforms2salt.sed
$<
|
sed
s/__SOURCE_FILENAME__/
$<
/g
>
$@
# .base -> .sed pattern rule
%.sed
:
%.base
sed
-f
transforms2sed.sed
$<
|
sed
s/__SOURCE_FILENAME__/
$<
/g
>
$@
transform
:
nodelocaldns.yaml.in nodelocaldns.yaml.sed
.PHONY
:
transform
cluster/addons/dns/nodelocaldns/nodelocaldns.yaml
.base
→
cluster/addons/dns/nodelocaldns/nodelocaldns.yaml
View file @
6d7c5e90
...
@@ -12,12 +12,11 @@
...
@@ -12,12 +12,11 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
#
#
# __MACHINE_GENERATED_WARNING__
apiVersion
:
v1
apiVersion
:
v1
kind
:
ServiceAccount
kind
:
ServiceAccount
metadata
:
metadata
:
name: node
local
dns
name
:
node
-local-
dns
namespace
:
kube-system
namespace
:
kube-system
labels
:
labels
:
kubernetes.io/cluster-service
:
"
true"
kubernetes.io/cluster-service
:
"
true"
...
@@ -27,11 +26,10 @@ metadata:
...
@@ -27,11 +26,10 @@ metadata:
apiVersion
:
v1
apiVersion
:
v1
kind
:
ConfigMap
kind
:
ConfigMap
metadata
:
metadata
:
name: node
local
dns
name
:
node
-local-
dns
namespace
:
kube-system
namespace
:
kube-system
labels
:
labels
:
addonmanager.kubernetes.io/mode
:
EnsureExists
addonmanager.kubernetes.io/mode
:
EnsureExists
data
:
data
:
Corefile
:
|
Corefile
:
|
__PILLAR__DNS__DOMAIN__:53 {
__PILLAR__DNS__DOMAIN__:53 {
...
@@ -83,7 +81,7 @@ data:
...
@@ -83,7 +81,7 @@ data:
apiVersion
:
apps/v1
apiVersion
:
apps/v1
kind
:
DaemonSet
kind
:
DaemonSet
metadata
:
metadata
:
name: node
local
dns
name
:
node
-local-
dns
namespace
:
kube-system
namespace
:
kube-system
labels
:
labels
:
k8s-app
:
kube-dns
k8s-app
:
kube-dns
...
@@ -92,14 +90,14 @@ metadata:
...
@@ -92,14 +90,14 @@ metadata:
spec
:
spec
:
selector
:
selector
:
matchLabels
:
matchLabels
:
k8s-app: node
local
dns
k8s-app
:
node
-local-
dns
template
:
template
:
metadata
:
metadata
:
labels
:
labels
:
k8s-app: node
local
dns
k8s-app
:
node
-local-
dns
spec
:
spec
:
priorityClassName
:
system-node-critical
priorityClassName
:
system-node-critical
serviceAccountName: node
local
dns
serviceAccountName
:
node
-local-
dns
hostNetwork
:
true
hostNetwork
:
true
dnsPolicy
:
Default
# Don't use cluster DNS.
dnsPolicy
:
Default
# Don't use cluster DNS.
tolerations
:
tolerations
:
...
@@ -132,19 +130,15 @@ spec:
...
@@ -132,19 +130,15 @@ spec:
host
:
__PILLAR__LOCAL__DNS__
host
:
__PILLAR__LOCAL__DNS__
path
:
/health
path
:
/health
port
:
8080
port
:
8080
scheme: HTTP
initialDelaySeconds
:
60
initialDelaySeconds
:
60
timeoutSeconds
:
5
timeoutSeconds
:
5
successThreshold: 1
failureThreshold: 3
volumeMounts
:
volumeMounts
:
-
name
:
config-volume
-
name
:
config-volume
mountPath
:
/etc/coredns
mountPath
:
/etc/coredns
volumes
:
volumes
:
-
name
:
config-volume
-
name
:
config-volume
configMap
:
configMap
:
name: node
local
dns
name
:
node
-local-
dns
items
:
items
:
-
key
:
Corefile
-
key
:
Corefile
path
:
Corefile
path
:
Corefile
terminationGracePeriodSeconds: 30
cluster/addons/dns/nodelocaldns/nodelocaldns.yaml.in
deleted
100644 → 0
View file @
73b548db
# Copyright 2018 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Warning: This is a file generated from the base underscore template file: nodelocaldns.yaml.base
apiVersion: v1
kind: ServiceAccount
metadata:
name: nodelocaldns
namespace: kube-system
labels:
kubernetes.io/cluster-service: "true"
addonmanager.kubernetes.io/mode: Reconcile
---
apiVersion: v1
kind: ConfigMap
metadata:
name: nodelocaldns
namespace: kube-system
labels:
addonmanager.kubernetes.io/mode: EnsureExists
data:
Corefile: |
{{ pillar['dns_domain'] }}:53 {
errors
cache 30
reload
loop
bind {{ pillar['local_dns_ip'] }}
forward . {{ pillar['dns_server'] }} {
force_tcp
}
prometheus :9253
health {{ pillar['local_dns_ip'] }}:8080
}
in-addr.arpa:53 {
errors
cache 30
reload
loop
bind {{ pillar['local_dns_ip'] }}
forward . {{ pillar['dns_server'] }} {
force_tcp
}
prometheus :9253
}
ip6.arpa:53 {
errors
cache 30
reload
loop
bind {{ pillar['local_dns_ip'] }}
forward . {{ pillar['dns_server'] }} {
force_tcp
}
prometheus :9253
}
.:53 {
errors
cache 30
reload
loop
bind {{ pillar['local_dns_ip'] }}
forward . /etc/resolv.conf {
force_tcp
}
prometheus :9253
}
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: nodelocaldns
namespace: kube-system
labels:
k8s-app: kube-dns
kubernetes.io/cluster-service: "true"
addonmanager.kubernetes.io/mode: Reconcile
spec:
selector:
matchLabels:
k8s-app: nodelocaldns
template:
metadata:
labels:
k8s-app: nodelocaldns
spec:
priorityClassName: system-node-critical
serviceAccountName: nodelocaldns
hostNetwork: true
dnsPolicy: Default # Don't use cluster DNS.
tolerations:
- key: "CriticalAddonsOnly"
operator: "Exists"
containers:
- name: node-cache
image: k8s.gcr.io/k8s-dns-node-cache:1.15.0
resources:
limits:
memory: 30Mi
requests:
cpu: 25m
memory: 5Mi
args: [ "-localip", "{{ pillar['local_dns_ip'] }}", "-conf", "/etc/coredns/Corefile" ]
securityContext:
privileged: true
ports:
- containerPort: 53
name: dns
protocol: UDP
- containerPort: 53
name: dns-tcp
protocol: TCP
- containerPort: 9253
name: metrics
protocol: TCP
livenessProbe:
httpGet:
host: {{ pillar['local_dns_ip'] }}
path: /health
port: 8080
scheme: HTTP
initialDelaySeconds: 60
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 3
volumeMounts:
- name: config-volume
mountPath: /etc/coredns
volumes:
- name: config-volume
configMap:
name: nodelocaldns
items:
- key: Corefile
path: Corefile
terminationGracePeriodSeconds: 30
cluster/addons/dns/nodelocaldns/nodelocaldns.yaml.sed
deleted
100644 → 0
View file @
73b548db
# Copyright 2018 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Warning: This is a file generated from the base underscore template file: nodelocaldns.yaml.base
a
piVersion: v1
k
i
nd: ServiceAccount
met
a
data:
na
me: nodelocaldns
na
mespace: kube-system
la
bels:
kuber
n
ete
s
.
io/cluster-service: "true"
addonmanager
.
kubernetes
.
i
o/mode: Reconcile
---
a
piVersion: v1
k
i
nd: ConfigMap
met
a
data:
na
me: nodelocaldns
na
mespace: kube-system
la
bels:
a
ddonmanager.kubernetes.io/mode: EnsureExists
da
ta:
Coref
i
le: |
$
D
NS_
D
OMAIN:53
{
error
s
cache 30
reload
l
oo
p
b
i
nd $LOCAL_DNS_IP
forw
a
rd . $DNS_SERVER_IP {
for
c
e_tcp
}
p
romet
h
eu
s
:9253
h
e
a
lth $LOCAL_DNS_IP:8080
}
i
n-addr.arpa:53 {
error
s
cache 30
reload
l
oo
p
b
i
nd $LOCAL_DNS_IP
forw
a
rd . $DNS_SERVER_IP {
for
c
e_tcp
}
p
romet
h
eu
s
:9253
}
i
p6.arpa:53 {
error
s
cache 30
reload
l
oo
p
b
i
nd $LOCAL_DNS_IP
forw
a
rd . $DNS_SERVER_IP {
for
c
e_tcp
}
p
romet
h
eu
s
:9253
}
.:53
{
error
s
cache 30
reload
l
oo
p
b
i
nd $LOCAL_DNS_IP
forw
a
rd . /etc/resolv.conf {
for
c
e_tcp
}
p
romet
h
eu
s
:9253
}
---
a
piVersion: apps/v1
k
i
nd: DaemonSet
met
a
data:
na
me: nodelocaldns
na
mespace: kube-system
la
bels:
k8
s
-
app: kube
-
dns
kubernetes.io/cluster
-
s
e
rvic
e
: "tru
e
"
a
ddonmanager.kubernetes.io/mode: Reconcile
s
p
ec:
selector:
matchLabels:
k8s-a
pp
:
nodelocaldns
tem
pla
te:
met
a
data:
la
bels:
k8
s
-
app: nodelocaldns
spec:
priorityClassName: system
-
node
-
c
ritical
s
e
rvic
e
AccountNam
e
:
nodelocaldns
h
o
s
t
Ne
t
work:
t
rue
dns
P
olicy: Default # Don't use cluster DNS
.
tolerations:
- key: "CriticalAddonsOnly"
operator: "Exists"
containers:
- name: node-cache
image: k8s
.
gcr
.
io/k8s-dns-node-cache:1
.
15
.
0
resources:
limits:
memory: 30Mi
requests:
cpu: 25m
memory: 5Mi
args:
[
"-l
ocalip", "$LOCAL_DNS_I
P
", "-conf", "/etc/coredns/Corefile" ]
securityContext:
privileged: true
ports:
- container
P
ort
:
53
na
me: dns
p
roto
c
ol: UDP
-
c
ontainerPort: 53
na
me: dns-tcp
p
roto
c
ol: TCP
-
c
ontainerPort: 9253
na
me: metrics
p
roto
c
ol: TCP
li
venessProbe:
h
tt
pG
et
:
host:
$
LOCAL_
D
NS_I
P
pa
th: /health
p
ort
:
8080
s
c
heme: HTTP
initialDelaySe
c
onds: 60
timeoutSe
c
o
nds
:
5
successThreshold
:
1
failureThreshold
:
3
vo
l
umeMou
n
t
s
:
-
name
:
config-volume
mountPath
:
/
etc
/
c
oredns
vo
l
ume
s
:
-
name
:
config-volume
configMap
:
na
me: nodelocaldns
i
tems:
-
ke
y
:
Corefile
path
:
Corefile
terminationGracePeriodSeconds
:
30
cluster/addons/dns/nodelocaldns/transforms2salt.sed
deleted
100644 → 0
View file @
73b548db
s
/
__PILLAR__DNS__SERVER__
/
{{ pillar['dns_server'] }}
/
g
s
/
__PILLAR__DNS__DOMAIN__
/
{{ pillar['dns_domain'] }}
/
g
s
/
__PILLAR__LOCAL__DNS__
/
{{ pillar['local_dns_ip'] }}
/
g
s
/
__MACHINE_GENERATED_WARNING__
/
Warning: This is a file generated from the base underscore template file: __SOURCE_FILENAME__
/
g
cluster/addons/dns/nodelocaldns/transforms2sed.sed
deleted
100644 → 0
View file @
73b548db
s
/
__PILLAR__DNS__SERVER__
/
$DNS_SERVER_IP
/
g
s
/
__PILLAR__DNS__DOMAIN__
/
$DNS_DOMAIN
/
g
s
/
__PILLAR__LOCAL__DNS__
/
$LOCAL_DNS_IP
/
g
s
/
__MACHINE_GENERATED_WARNING__
/
Warning: This is a file generated from the base underscore template file: __SOURCE_FILENAME__
/
g
cluster/centos/config-default.sh
View file @
6d7c5e90
...
@@ -108,10 +108,8 @@ export SERVICE_CLUSTER_IP_RANGE=${SERVICE_CLUSTER_IP_RANGE:-"192.168.3.0/24"}
...
@@ -108,10 +108,8 @@ export SERVICE_CLUSTER_IP_RANGE=${SERVICE_CLUSTER_IP_RANGE:-"192.168.3.0/24"}
# Optional: Install cluster DNS.
# Optional: Install cluster DNS.
ENABLE_CLUSTER_DNS
=
"
${
KUBE_ENABLE_CLUSTER_DNS
:-
true
}
"
ENABLE_CLUSTER_DNS
=
"
${
KUBE_ENABLE_CLUSTER_DNS
:-
true
}
"
ENABLE_NODELOCAL_DNS
=
"
${
KUBE_ENABLE_NODELOCAL_DNS
:-
false
}
"
# DNS_SERVER_IP must be a IP in SERVICE_CLUSTER_IP_RANGE
# DNS_SERVER_IP must be a IP in SERVICE_CLUSTER_IP_RANGE
DNS_SERVER_IP
=
${
DNS_SERVER_IP
:-
"192.168.3.100"
}
DNS_SERVER_IP
=
${
DNS_SERVER_IP
:-
"192.168.3.100"
}
LOCAL_DNS_IP
=
${
LOCAL_DNS_IP
:-
"169.254.20.10"
}
DNS_DOMAIN
=
${
DNS_DOMAIN
:-
"cluster.local"
}
DNS_DOMAIN
=
${
DNS_DOMAIN
:-
"cluster.local"
}
# Optional: Install Kubernetes UI
# Optional: Install Kubernetes UI
...
...
cluster/centos/deployAddons.sh
View file @
6d7c5e90
...
@@ -44,28 +44,6 @@ function deploy_dns {
...
@@ -44,28 +44,6 @@ function deploy_dns {
echo
echo
}
}
function
deploy_nodelocaldns
{
echo
"Deploying NodeLocalDNS on Kubernetes"
cp
"
${
KUBE_ROOT
}
/cluster/addons/dns/nodelocaldns/nodelocaldns.yaml.sed"
nodelocaldns.yaml
sed
-i
-e
"s/
\\\$
DNS_DOMAIN/
${
DNS_DOMAIN
}
/g"
nodelocaldns.yaml
sed
-i
-e
"s/
\\\$
DNS_SERVER_IP/
${
DNS_SERVER_IP
}
/g"
nodelocaldns.yaml
sed
-i
-e
"s/
\\\$
LOCAL_DNS_IP/
${
LOCAL_DNS_IP
}
/g"
nodelocaldns.yaml
NODELOCALDNS
=
$(${
KUBECTL
}
get pods
--namespace
=
kube-system
-o
jsonpath
=
'{.items[*].metadata.name}'
\
|
tr
' '
"
\n
"
|
grep
"nodelocaldns"
)
if
[[
-z
"
${
NODELOCALDNS
}
"
]]
;
then
# use kubectl to create nodelocaldns addon
${
KUBECTL
}
--namespace
=
kube-system create
-f
nodelocaldns.yaml
echo
"NodeLocalDNS addon is successfully deployed."
else
echo
"NodeLocalDNS addon is already deployed. Skipping."
fi
echo
}
function
deploy_dashboard
{
function
deploy_dashboard
{
echo
"Deploying Kubernetes Dashboard"
echo
"Deploying Kubernetes Dashboard"
...
@@ -79,14 +57,11 @@ function deploy_dashboard {
...
@@ -79,14 +57,11 @@ function deploy_dashboard {
}
}
if
[
[
"
${
ENABLE_CLUSTER_DNS
}
"
==
"true"
]
]
;
then
if
[
"
${
ENABLE_CLUSTER_DNS
}
"
==
true
]
;
then
deploy_dns
deploy_dns
fi
fi
if
[[
"
${
ENABLE_NODELOCAL_DNS
}
"
==
"true"
]]
;
then
if
[
"
${
ENABLE_CLUSTER_UI
}
"
==
true
]
;
then
deploy_nodelocaldns
fi
if
[[
"
${
ENABLE_CLUSTER_UI
}
"
==
"true"
]]
;
then
deploy_dashboard
deploy_dashboard
fi
fi
cluster/centos/util.sh
View file @
6d7c5e90
...
@@ -302,16 +302,11 @@ function post-provision-master() {
...
@@ -302,16 +302,11 @@ function post-provision-master() {
# DOCKER_OPTS
# DOCKER_OPTS
# DNS_SERVER_IP
# DNS_SERVER_IP
# DNS_DOMAIN
# DNS_DOMAIN
# ENABLE_NODELOCAL_DNS
# LOCAL_DNS_IP
function
provision-node
()
{
function
provision-node
()
{
echo
"[INFO] Provision node on
$1
"
echo
"[INFO] Provision node on
$1
"
local
node
=
$1
local
node
=
$1
local
node_ip
=
${
node
#*@
}
local
node_ip
=
${
node
#*@
}
local
dns_ip
=
${
DNS_SERVER_IP
#*@
}
local
dns_ip
=
${
DNS_SERVER_IP
#*@
}
if
[
"
${
ENABLE_NODELOCAL_DNS
}
"
==
true
]
;
then
dns_ip
=
${
LOCAL_DNS_IP
}
fi
local
dns_domain
=
${
DNS_DOMAIN
#*@
}
local
dns_domain
=
${
DNS_DOMAIN
#*@
}
ensure-setup-dir
${
node
}
ensure-setup-dir
${
node
}
...
...
cluster/gce/gci/configure-helper.sh
View file @
6d7c5e90
...
@@ -2351,12 +2351,12 @@ EOF
...
@@ -2351,12 +2351,12 @@ EOF
# Sets up the manifests of local dns cache agent for k8s addons.
# Sets up the manifests of local dns cache agent for k8s addons.
function
setup-nodelocaldns-manifest
{
function
setup-nodelocaldns-manifest
{
setup-addon-manifests
"addons"
"dns/nodelocaldns"
local
-r
localdns_file
=
"
${
dst_dir
}
/dns/nodelocaldns/nodelocaldns.yaml"
local
-r
localdns_file
=
"
${
dst_dir
}
/dns/nodelocaldns/nodelocaldns.yaml"
mv
"
${
dst_dir
}
/dns/nodelocaldns/nodelocaldns.yaml.in"
"
${
localdns_file
}
"
# Replace the sed configurations with variable values.
# Replace the salt configurations with variable values.
sed
-i
-e
"s/__PILLAR__DNS__DOMAIN__/
${
DNS_DOMAIN
}
/g"
"
${
localdns_file
}
"
sed
-i
-e
"s@{{ *pillar
\[
'dns_domain'
\]
*}}@
${
DNS_DOMAIN
}
@g"
"
${
localdns_file
}
"
sed
-i
-e
"s/__PILLAR__DNS__SERVER__/
${
DNS_SERVER_IP
}
/g"
"
${
localdns_file
}
"
sed
-i
-e
"s@{{ *pillar
\[
'dns_server'
\]
*}}@
${
DNS_SERVER_IP
}
@g"
"
${
localdns_file
}
"
sed
-i
-e
"s/__PILLAR__LOCAL__DNS__/
${
LOCAL_DNS_IP
}
/g"
"
${
localdns_file
}
"
sed
-i
-e
"s@{{ *pillar
\[
'local_dns_ip'
\]
*}}@
${
LOCAL_DNS_IP
}
@g"
"
${
localdns_file
}
"
}
}
# Sets up the manifests of netd for k8s addons.
# Sets up the manifests of netd for k8s addons.
...
@@ -2531,7 +2531,6 @@ EOF
...
@@ -2531,7 +2531,6 @@ EOF
setup-kube-dns-manifest
setup-kube-dns-manifest
fi
fi
if
[[
"
${
ENABLE_NODELOCAL_DNS
:-}
"
==
"true"
]]
;
then
if
[[
"
${
ENABLE_NODELOCAL_DNS
:-}
"
==
"true"
]]
;
then
setup-addon-manifests
"addons"
"dns/nodelocaldns"
setup-nodelocaldns-manifest
setup-nodelocaldns-manifest
fi
fi
fi
fi
...
...
hack/local-up-cluster.sh
View file @
6d7c5e90
...
@@ -706,7 +706,7 @@ function start_kubelet {
...
@@ -706,7 +706,7 @@ function start_kubelet {
mkdir -p "
/var/lib/kubelet
" &>/dev/null || sudo mkdir -p "
/var/lib/kubelet
"
mkdir -p "
/var/lib/kubelet
" &>/dev/null || sudo mkdir -p "
/var/lib/kubelet
"
# Enable dns
# Enable dns
if [[ "
${
ENABLE_CLUSTER_DNS
}
" = true ]]; then
if [[ "
${
ENABLE_CLUSTER_DNS
}
" = true ]]; then
if [[ "
${
ENABLE_NODELOCAL_DNS
}
" = true
]]; then
if [[ "
${
ENABLE_NODELOCAL_DNS
:-}
" == "
true
"
]]; then
dns_args="
--cluster-dns=
${
LOCAL_DNS_IP
}
--cluster-domain=
${
DNS_DOMAIN
}
"
dns_args="
--cluster-dns=
${
LOCAL_DNS_IP
}
--cluster-domain=
${
DNS_DOMAIN
}
"
else
else
dns_args="
--cluster-dns=
${
DNS_SERVER_IP
}
--cluster-domain=
${
DNS_DOMAIN
}
"
dns_args="
--cluster-dns=
${
DNS_SERVER_IP
}
--cluster-domain=
${
DNS_DOMAIN
}
"
...
@@ -915,22 +915,14 @@ function start_kubedns {
...
@@ -915,22 +915,14 @@ function start_kubedns {
}
}
function start_nodelocaldns {
function start_nodelocaldns {
if [[ "
${
ENABLE_NODELOCAL_DNS
}
" = true ]]; then
cp "
${
KUBE_ROOT
}
/cluster/addons/dns/nodelocaldns/nodelocaldns.yaml
" nodelocaldns.yaml
cp "
${
KUBE_ROOT
}
/cluster/addons/dns/nodelocaldns/localdns.yaml.in
" nodelocaldns.yaml
sed -i -e "
s/__PILLAR__DNS__DOMAIN__/
${
DNS_DOMAIN
}
/g
" nodelocaldns.yaml
sed -i -e "
s/
{{
pillar
\[
'dns_domain'
\]
}}
/
${
DNS_DOMAIN
}
/g
" nodelocaldns.yaml
sed -i -e "
s/__PILLAR__DNS__SERVER__/
${
DNS_SERVER_IP
}
/g
" nodelocaldns.yaml
sed -i -e "
s/
{{
pillar
\[
'dns_server'
\]
}}
/
${
DNS_SERVER_IP
}
/g
" nodelocaldns.yaml
sed -i -e "
s/__PILLAR__LOCAL__DNS__/
${
LOCAL_DNS_IP
}
/g
" nodelocaldns.yaml
sed -i -e "
s/
{{
pillar
\[
'local_dns_ip'
\]
}}
/
${
LOCAL_DNS_IP
}
/g
" nodelocaldns.yaml
if [[ -n "
${
CLUSTER_IP_RANGE
:-}
" ]]; then
sed -i -e "
s@
{{
*
pillar
\[
'service_cluster_ip_range'
\]
*
}}
@
${
CLUSTER_IP_RANGE
}
@g
" nodelocaldns.yaml
else
sed -i -e "
s@
{{
*
pillar
\[
'service_cluster_ip_range'
\]
*
}}
@0.0.0.0@g
" nodelocaldns.yaml
fi
# TODO update to dns role once we have one.
# use kubectl to create nodelocaldns addon
# use kubectl to create nodelocaldns addon
${
KUBECTL
}
--kubeconfig="
${
CERT_DIR
}
/admin.kubeconfig
" --namespace=kube-system create -f nodelocaldns.yaml
${
KUBECTL
}
--kubeconfig="
${
CERT_DIR
}
/admin.kubeconfig
" --namespace=kube-system create -f nodelocaldns.yaml
echo "
NodeLocalDNS addon successfully deployed.
"
echo "
NodeLocalDNS addon successfully deployed.
"
rm nodelocaldns.yaml
rm nodelocaldns.yaml
fi
}
}
function start_kubedashboard {
function start_kubedashboard {
...
@@ -1081,7 +1073,9 @@ if [[ "${START_MODE}" != "kubeletonly" ]]; then
...
@@ -1081,7 +1073,9 @@ if [[ "${START_MODE}" != "kubeletonly" ]]; then
fi
fi
start_kubeproxy
start_kubeproxy
start_kubedns
start_kubedns
if [[ "
${
ENABLE_NODELOCAL_DNS
:-}
" == "
true
" ]]; then
start_nodelocaldns
start_nodelocaldns
fi
start_kubedashboard
start_kubedashboard
fi
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment