Closed qrkourier closed 4 months ago
Added this and it can be overwritten by the env var
if len(clusterDnsServiceIP) == 0 {
dnsService, err := kClient.CoreV1().Services("kube-system").Get(context.TODO(), "kube-dns", metav1.GetOptions{})
if err != nil {
klog.Error(err)
}
if len(dnsService.Spec.ClusterIP) != 0 {
clusterDnsServiceIP = dnsService.Spec.ClusterIP
klog.Infof(fmt.Sprintf("Looked up DNS SVC ClusterIP and is %s", dnsService.Spec.ClusterIP))
} else {
klog.Info("Looked up DNS SVC ClusterIP and is not found")
}
}
Each tproxy sidecar needs cluster DNS configuration to effect precedence:
For the MVP we can find and inject the coredns or kube-dns ClusterIP by the common label selector:
k8s-app=kube-dns
e.g.,