changeset 78:fb68881b79a0

dns fussing
author drewp@bigasterisk.com
date Wed, 15 Jun 2022 21:32:25 -0700
parents 996f39b03494
children 3f7d4626234c
files dns_check.py dns_k8s_check.py templates/kube/coredns.yaml templates/net/bang_10.2.network.j2 templates/net/bang_isp.network.j2
diffstat 5 files changed, 20 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/dns_check.py	Wed Jun 15 21:31:53 2022 -0700
+++ b/dns_check.py	Wed Jun 15 21:32:25 2022 -0700
@@ -33,13 +33,13 @@
 '''
 
 if host.name in ['dash', 'bang', 'slash']:
-    check('dash', '10.2.0.199')
+    check('dash', '10.2.0.212')
     check('projects.bigasterisk.com', '10.2.0.1')
 elif host.name in ['prime']:
     check('dash', '10.5.0.5')
     check('projects.bigasterisk.com', '10.2.0.1')  # expected the public addr, but fine
 else:
-    check('dash', '10.2.0.199')
+    check('dash', '10.2.0.212')
     check('projects.bigasterisk.com', '10.2.0.1')
 
 if host.name in ['prime']:
--- a/dns_k8s_check.py	Wed Jun 15 21:31:53 2022 -0700
+++ b/dns_k8s_check.py	Wed Jun 15 21:32:25 2022 -0700
@@ -1,6 +1,11 @@
 import json
 import subprocess
 
+corednsConfig = subprocess.check_output(["kubectl", "get", "-n", "kube-system", "configmap/coredns", "-o", "yaml"]).decode('ascii')
+print(corednsConfig)
+if 'forward . 10.5.0.1' not in corednsConfig:
+    raise ValueError("coredns config is wrong")
+
 subprocess.check_call(["skaffold", "run"], cwd="/my/proj/infra/k8s_lookup/")
 
 try:
--- a/templates/kube/coredns.yaml	Wed Jun 15 21:31:53 2022 -0700
+++ b/templates/kube/coredns.yaml	Wed Jun 15 21:32:25 2022 -0700
@@ -58,7 +58,7 @@
         errors
         health
         ready
-        kubernetes %{CLUSTER_DOMAIN}% in-addr.arpa ip6.arpa {
+        kubernetes cluster.local in-addr.arpa ip6.arpa {
           pods insecure
           fallthrough in-addr.arpa ip6.arpa
         }
@@ -113,6 +113,14 @@
           effect: "NoSchedule"
       nodeSelector:
         kubernetes.io/os: linux
+      affinity: # because dns is broken so often, and it might be a circular config that can't start unless this is on bang
+        nodeAffinity:
+          requiredDuringSchedulingIgnoredDuringExecution:
+            nodeSelectorTerms:
+            - matchExpressions:
+              - key: "kubernetes.io/hostname"
+                operator: In
+                values: ["bang"]
       topologySpreadConstraints:
         - maxSkew: 1
           topologyKey: kubernetes.io/hostname
@@ -122,7 +130,7 @@
               k8s-app: kube-dns
       containers:
       - name: coredns
-        image: %{SYSTEM_DEFAULT_REGISTRY}%rancher/mirrored-coredns-coredns:1.9.1
+        image: rancher/mirrored-coredns-coredns:1.9.1
         imagePullPolicy: IfNotPresent
         resources:
           limits:
@@ -206,7 +214,7 @@
 spec:
   selector:
     k8s-app: kube-dns
-  clusterIP: %{CLUSTER_DNS}%
+  clusterIP: '10.43.0.10'
   ports:
   - name: dns
     port: 53
--- a/templates/net/bang_10.2.network.j2	Wed Jun 15 21:31:53 2022 -0700
+++ b/templates/net/bang_10.2.network.j2	Wed Jun 15 21:32:25 2022 -0700
@@ -7,4 +7,4 @@
 DHCP=no
 Address=10.2.0.1/16
 DNS=10.2.0.1
-Domains=bigasterisk.com
+DNSDefaultRoute=true
--- a/templates/net/bang_isp.network.j2	Wed Jun 15 21:31:53 2022 -0700
+++ b/templates/net/bang_isp.network.j2	Wed Jun 15 21:32:25 2022 -0700
@@ -4,10 +4,8 @@
 MACAddress=64:ee:b7:14:81:9e
 
 [Network]
-# in particular, don't take DNS addrs from this dhcp server
-UseDNS=false
 DHCP=no
 Address=192.168.42.2/24
 Gateway=192.168.42.1
 DNS=10.2.0.1
-Domains=bigasterisk.com
\ No newline at end of file
+DNSDefaultRoute=true