Skip to content

Commit

Permalink
Add nodeSelctor for other services and node labels before CNI setup
Browse files Browse the repository at this point in the history
  • Loading branch information
efrikin committed May 13, 2021
1 parent b1b407a commit 0a8bd1f
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@
roles:
- { role: kubespray-defaults }
- { role: kubernetes/kubeadm, tags: kubeadm}
- { role: network_plugin, tags: network }
- { role: kubernetes/node-label, tags: node-label }
- { role: network_plugin, tags: network }

- hosts: calico_rr
gather_facts: False
Expand Down
5 changes: 4 additions & 1 deletion roles/kubernetes-apps/ansible/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,18 @@ dns_prevent_single_point_failure: "{{ 'true' if dns_min_replicas|int > 1 else 'f
enable_coredns_reverse_dns_lookups: true
coredns_ordinal_suffix: ""
# dns_extra_tolerations: [{effect: NoSchedule, operator: "Exists"}]
coredns_deployment_nodeselector: "kubernetes.io/os: linux"

# nodelocaldns
nodelocaldns_cpu_requests: 100m
nodelocaldns_memory_limit: 170Mi
nodelocaldnsdns_memory_requests: 70Mi
nodelocaldns_memory_requests: 70Mi
nodelocaldns_ds_nodeselector: "kubernetes.io/os: linux"

# Limits for dns-autoscaler
dns_autoscaler_cpu_requests: 20m
dns_autoscaler_memory_requests: 10Mi
dns_autoscaler_deployment_nodeselector: "kubernetes.io/os: linux"

# Netchecker
deploy_netchecker: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ spec:
seccomp.security.alpha.kubernetes.io/pod: 'runtime/default'
createdby: 'kubespray'
spec:
priorityClassName: system-cluster-critical
nodeSelector:
kubernetes.io/os: linux
{{ coredns_deployment_nodeselector }}
priorityClassName: system-cluster-critical
serviceAccountName: coredns
tolerations:
- key: node-role.kubernetes.io/master
Expand Down
2 changes: 2 additions & 0 deletions roles/kubernetes-apps/ansible/templates/dns-autoscaler.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ spec:
annotations:
seccomp.security.alpha.kubernetes.io/pod: 'runtime/default'
spec:
nodeSelector:
{{ dns_autoscaler_deployment_nodeselector}}
priorityClassName: system-cluster-critical
securityContext:
supplementalGroups: [ 65534 ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ spec:
prometheus.io/scrape: 'true'
prometheus.io/port: '9253'
spec:
nodeSelector:
{{ nodelocaldns_ds_nodeselector }}
priorityClassName: system-cluster-critical
serviceAccountName: nodelocaldns
hostNetwork: true
Expand All @@ -35,7 +37,7 @@ spec:
memory: {{ nodelocaldns_memory_limit }}
requests:
cpu: {{ nodelocaldns_cpu_requests }}
memory: {{ nodelocaldnsdns_memory_requests }}
memory: {{ nodelocaldns_memory_requests }}
args: [ "-localip", "{{ nodelocaldns_ip }}", "-conf", "/etc/coredns/Corefile", "-upstreamsvc", "coredns" ]
securityContext:
privileged: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ calico_policy_controller_cpu_limit: 100m
calico_policy_controller_memory_limit: 256M
calico_policy_controller_cpu_requests: 30m
calico_policy_controller_memory_requests: 64M
calico_policy_controller_deployment_nodeselector: "kubernetes.io/os: linux"

# SSL
calico_cert_dir: "/etc/calico/certs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
k8s-app: calico-kube-controllers
spec:
nodeSelector:
kubernetes.io/os: linux
{{ calico_policy_controller_deployment_nodeselector }}
hostNetwork: true
serviceAccountName: calico-kube-controllers
tolerations:
Expand Down
3 changes: 3 additions & 0 deletions roles/network_plugin/calico/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ calico_node_memory_requests: 64M
calico_node_cpu_requests: 150m
calico_felix_chaininsertmode: Insert

# Calico daemonset nodeselector
calico_ds_nodeselector: "kubernetes.io/os: linux"

# Virtual network ID to use for VXLAN traffic. A value of 0 means “use the kernel default”.
calico_vxlan_vni: 4096

Expand Down
2 changes: 2 additions & 0 deletions roles/network_plugin/calico/templates/calico-node.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ spec:
prometheus.io/port: "{{ calico_felix_prometheusmetricsport }}"
{% endif %}
spec:
nodeSelector:
{{ calico_ds_nodeselector }}
priorityClassName: system-node-critical
hostNetwork: true
serviceAccountName: calico-node
Expand Down
2 changes: 1 addition & 1 deletion scale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,5 @@
roles:
- { role: kubespray-defaults }
- { role: kubernetes/kubeadm, tags: kubeadm }
- { role: network_plugin, tags: network }
- { role: kubernetes/node-label, tags: node-label }
- { role: network_plugin, tags: network }

0 comments on commit 0a8bd1f

Please sign in to comment.