mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
autoscaler support for CoreDNS
This commit is contained in:
parent
6bf1871e73
commit
8d5b9d3c36
@ -91,7 +91,7 @@ spec:
|
|||||||
- --namespace=kube-system
|
- --namespace=kube-system
|
||||||
- --configmap=kube-dns-autoscaler
|
- --configmap=kube-dns-autoscaler
|
||||||
# Should keep target in sync with cluster/addons/dns/kube-dns.yaml.base
|
# Should keep target in sync with cluster/addons/dns/kube-dns.yaml.base
|
||||||
- --target=Deployment/kube-dns
|
- --target={{.Target}}
|
||||||
# When cluster is using large nodes(with more cores), "coresPerReplica" should dominate.
|
# When cluster is using large nodes(with more cores), "coresPerReplica" should dominate.
|
||||||
# If using small nodes, "nodesPerReplica" should dominate.
|
# If using small nodes, "nodesPerReplica" should dominate.
|
||||||
- --default-params={"linear":{"coresPerReplica":256,"nodesPerReplica":16,"preventSinglePointFailure":true}}
|
- --default-params={"linear":{"coresPerReplica":256,"nodesPerReplica":16,"preventSinglePointFailure":true}}
|
||||||
|
@ -74,23 +74,26 @@ metadata:
|
|||||||
name: coredns
|
name: coredns
|
||||||
namespace: kube-system
|
namespace: kube-system
|
||||||
labels:
|
labels:
|
||||||
k8s-app: coredns
|
k8s-app: kube-dns
|
||||||
kubernetes.io/cluster-service: "true"
|
kubernetes.io/cluster-service: "true"
|
||||||
addonmanager.kubernetes.io/mode: Reconcile
|
addonmanager.kubernetes.io/mode: Reconcile
|
||||||
kubernetes.io/name: "CoreDNS"
|
kubernetes.io/name: "CoreDNS"
|
||||||
spec:
|
spec:
|
||||||
replicas: 2
|
# replicas: not specified here:
|
||||||
|
# 1. In order to make Addon Manager do not reconcile this replicas parameter.
|
||||||
|
# 2. Default is 1.
|
||||||
|
# 3. Will be tuned in real time if DNS horizontal auto-scaling is turned on.
|
||||||
strategy:
|
strategy:
|
||||||
type: RollingUpdate
|
type: RollingUpdate
|
||||||
rollingUpdate:
|
rollingUpdate:
|
||||||
maxUnavailable: 1
|
maxUnavailable: 1
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
k8s-app: coredns
|
k8s-app: kube-dns
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
k8s-app: coredns
|
k8s-app: kube-dns
|
||||||
spec:
|
spec:
|
||||||
serviceAccountName: coredns
|
serviceAccountName: coredns
|
||||||
tolerations:
|
tolerations:
|
||||||
@ -140,16 +143,16 @@ spec:
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: coredns
|
name: kube-dns
|
||||||
namespace: kube-system
|
namespace: kube-system
|
||||||
labels:
|
labels:
|
||||||
k8s-app: coredns
|
k8s-app: kube-dns
|
||||||
kubernetes.io/cluster-service: "true"
|
kubernetes.io/cluster-service: "true"
|
||||||
addonmanager.kubernetes.io/mode: Reconcile
|
addonmanager.kubernetes.io/mode: Reconcile
|
||||||
kubernetes.io/name: "CoreDNS"
|
kubernetes.io/name: "CoreDNS"
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
k8s-app: coredns
|
k8s-app: kube-dns
|
||||||
clusterIP: __PILLAR__DNS__SERVER__
|
clusterIP: __PILLAR__DNS__SERVER__
|
||||||
ports:
|
ports:
|
||||||
- name: dns
|
- name: dns
|
||||||
|
@ -74,23 +74,26 @@ metadata:
|
|||||||
name: coredns
|
name: coredns
|
||||||
namespace: kube-system
|
namespace: kube-system
|
||||||
labels:
|
labels:
|
||||||
k8s-app: coredns
|
k8s-app: kube-dns
|
||||||
kubernetes.io/cluster-service: "true"
|
kubernetes.io/cluster-service: "true"
|
||||||
addonmanager.kubernetes.io/mode: Reconcile
|
addonmanager.kubernetes.io/mode: Reconcile
|
||||||
kubernetes.io/name: "CoreDNS"
|
kubernetes.io/name: "CoreDNS"
|
||||||
spec:
|
spec:
|
||||||
replicas: 2
|
# replicas: not specified here:
|
||||||
|
# 1. In order to make Addon Manager do not reconcile this replicas parameter.
|
||||||
|
# 2. Default is 1.
|
||||||
|
# 3. Will be tuned in real time if DNS horizontal auto-scaling is turned on.
|
||||||
strategy:
|
strategy:
|
||||||
type: RollingUpdate
|
type: RollingUpdate
|
||||||
rollingUpdate:
|
rollingUpdate:
|
||||||
maxUnavailable: 1
|
maxUnavailable: 1
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
k8s-app: coredns
|
k8s-app: kube-dns
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
k8s-app: coredns
|
k8s-app: kube-dns
|
||||||
spec:
|
spec:
|
||||||
serviceAccountName: coredns
|
serviceAccountName: coredns
|
||||||
tolerations:
|
tolerations:
|
||||||
@ -140,16 +143,16 @@ spec:
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: coredns
|
name: kube-dns
|
||||||
namespace: kube-system
|
namespace: kube-system
|
||||||
labels:
|
labels:
|
||||||
k8s-app: coredns
|
k8s-app: kube-dns
|
||||||
kubernetes.io/cluster-service: "true"
|
kubernetes.io/cluster-service: "true"
|
||||||
addonmanager.kubernetes.io/mode: Reconcile
|
addonmanager.kubernetes.io/mode: Reconcile
|
||||||
kubernetes.io/name: "CoreDNS"
|
kubernetes.io/name: "CoreDNS"
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
k8s-app: coredns
|
k8s-app: kube-dns
|
||||||
clusterIP: {{ pillar['dns_server'] }}
|
clusterIP: {{ pillar['dns_server'] }}
|
||||||
ports:
|
ports:
|
||||||
- name: dns
|
- name: dns
|
||||||
|
@ -74,23 +74,26 @@ metadata:
|
|||||||
name: coredns
|
name: coredns
|
||||||
namespace: kube-system
|
namespace: kube-system
|
||||||
labels:
|
labels:
|
||||||
k8s-app: coredns
|
k8s-app: kube-dns
|
||||||
kubernetes.io/cluster-service: "true"
|
kubernetes.io/cluster-service: "true"
|
||||||
addonmanager.kubernetes.io/mode: Reconcile
|
addonmanager.kubernetes.io/mode: Reconcile
|
||||||
kubernetes.io/name: "CoreDNS"
|
kubernetes.io/name: "CoreDNS"
|
||||||
spec:
|
spec:
|
||||||
replicas: 2
|
# replicas: not specified here:
|
||||||
|
# 1. In order to make Addon Manager do not reconcile this replicas parameter.
|
||||||
|
# 2. Default is 1.
|
||||||
|
# 3. Will be tuned in real time if DNS horizontal auto-scaling is turned on.
|
||||||
strategy:
|
strategy:
|
||||||
type: RollingUpdate
|
type: RollingUpdate
|
||||||
rollingUpdate:
|
rollingUpdate:
|
||||||
maxUnavailable: 1
|
maxUnavailable: 1
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
k8s-app: coredns
|
k8s-app: kube-dns
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
k8s-app: coredns
|
k8s-app: kube-dns
|
||||||
spec:
|
spec:
|
||||||
serviceAccountName: coredns
|
serviceAccountName: coredns
|
||||||
tolerations:
|
tolerations:
|
||||||
@ -140,16 +143,16 @@ spec:
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: coredns
|
name: kube-dns
|
||||||
namespace: kube-system
|
namespace: kube-system
|
||||||
labels:
|
labels:
|
||||||
k8s-app: coredns
|
k8s-app: kube-dns
|
||||||
kubernetes.io/cluster-service: "true"
|
kubernetes.io/cluster-service: "true"
|
||||||
addonmanager.kubernetes.io/mode: Reconcile
|
addonmanager.kubernetes.io/mode: Reconcile
|
||||||
kubernetes.io/name: "CoreDNS"
|
kubernetes.io/name: "CoreDNS"
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
k8s-app: coredns
|
k8s-app: kube-dns
|
||||||
clusterIP: $DNS_SERVER_IP
|
clusterIP: $DNS_SERVER_IP
|
||||||
ports:
|
ports:
|
||||||
- name: dns
|
- name: dns
|
||||||
|
@ -27,6 +27,8 @@ set -o pipefail
|
|||||||
|
|
||||||
readonly UUID_MNT_PREFIX="/mnt/disks/by-uuid/google-local-ssds"
|
readonly UUID_MNT_PREFIX="/mnt/disks/by-uuid/google-local-ssds"
|
||||||
readonly UUID_BLOCK_PREFIX="/dev/disk/by-uuid/google-local-ssds"
|
readonly UUID_BLOCK_PREFIX="/dev/disk/by-uuid/google-local-ssds"
|
||||||
|
readonly COREDNS_AUTOSCALER="Deployment/coredns"
|
||||||
|
readonly KUBEDNS_AUTOSCALER="Deployment/kube-dns"
|
||||||
|
|
||||||
# Use --retry-connrefused opt only if it's supported by curl.
|
# Use --retry-connrefused opt only if it's supported by curl.
|
||||||
CURL_RETRY_CONNREFUSED=""
|
CURL_RETRY_CONNREFUSED=""
|
||||||
@ -2049,6 +2051,12 @@ function setup-coredns-manifest {
|
|||||||
sed -i -e "s@{{ *pillar\['dns_domain'\] *}}@${DNS_DOMAIN}@g" "${coredns_file}"
|
sed -i -e "s@{{ *pillar\['dns_domain'\] *}}@${DNS_DOMAIN}@g" "${coredns_file}"
|
||||||
sed -i -e "s@{{ *pillar\['dns_server'\] *}}@${DNS_SERVER_IP}@g" "${coredns_file}"
|
sed -i -e "s@{{ *pillar\['dns_server'\] *}}@${DNS_SERVER_IP}@g" "${coredns_file}"
|
||||||
sed -i -e "s@{{ *pillar\['service_cluster_ip_range'\] *}}@${SERVICE_CLUSTER_IP_RANGE}@g" "${coredns_file}"
|
sed -i -e "s@{{ *pillar\['service_cluster_ip_range'\] *}}@${SERVICE_CLUSTER_IP_RANGE}@g" "${coredns_file}"
|
||||||
|
|
||||||
|
if [[ "${ENABLE_DNS_HORIZONTAL_AUTOSCALER:-}" == "true" ]]; then
|
||||||
|
setup-addon-manifests "addons" "dns-horizontal-autoscaler" "gce"
|
||||||
|
local -r dns_autoscaler_file="${dst_dir}/dns-horizontal-autoscaler/dns-horizontal-autoscaler.yaml"
|
||||||
|
sed -i'' -e "s@{{.Target}}@${COREDNS_AUTOSCALER}@g" "${dns_autoscaler_file}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Sets up the manifests of Fluentd configmap and yamls for k8s addons.
|
# Sets up the manifests of Fluentd configmap and yamls for k8s addons.
|
||||||
@ -2098,6 +2106,8 @@ EOF
|
|||||||
|
|
||||||
if [[ "${ENABLE_DNS_HORIZONTAL_AUTOSCALER:-}" == "true" ]]; then
|
if [[ "${ENABLE_DNS_HORIZONTAL_AUTOSCALER:-}" == "true" ]]; then
|
||||||
setup-addon-manifests "addons" "dns-horizontal-autoscaler" "gce"
|
setup-addon-manifests "addons" "dns-horizontal-autoscaler" "gce"
|
||||||
|
local -r dns_autoscaler_file="${dst_dir}/dns-horizontal-autoscaler/dns-horizontal-autoscaler.yaml"
|
||||||
|
sed -i'' -e "s@{{.Target}}@${KUBEDNS_AUTOSCALER}@g" "${dns_autoscaler_file}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user