kubernetes-sigs / external-dns

Configure external DNS servers (AWS Route53, Google CloudDNS and others) for Kubernetes Ingresses and Services
Apache License 2.0
7.73k stars 2.57k forks source link

Rancher2 and Bind9 failed to sync cache #1194

Closed ppiccolo closed 5 years ago

ppiccolo commented 5 years ago

Hello, I'm using a kubernetes cluster deployed via rancher2, and an external BIND9 instance as DNS.

This is my configuration :

--source=ingress 
--source=service 
--provider=rfc2136 
--rfc2136-host=10.10.40.2 
--rfc2136-port=53 
--rfc2136-zone=xxxxxxx.com 
--rfc2136-tsig-secret=xxxxxxxxxxxxx== 
--rfc2136-tsig-secret-alg=hmac-md5 
--rfc2136-tsig-keyname=rndc-key 
--rfc2136-insecure 
--registry=txt 
--log-level=debug 
--rfc2136-tsig-axfr 
--policy=upsert-only 
--interval=5m

Process fail with following error :

[0000] config: {Master: KubeConfig: RequestTimeout:30s IstioIngressGatewayServices:[istio-system/istio-ingressgateway] ContourLoadBalancerService:heptio-contour/contour Sources:[ingress service] Namespace: AnnotationFilter: FQDNTemplate: CombineFQDNAndAnnotation:false IgnoreHostnameAnnotation:false Compatibility: PublishInternal:false PublishHostIP:false ConnectorSourceServer:localhost:8080 Provider:rfc2136 GoogleProject: DomainFilter:[] ExcludeDomains:[] ZoneIDFilter:[] AlibabaCloudConfigFile:/etc/kubernetes/alibaba-cloud.json AlibabaCloudZoneType: AWSZoneType: AWSZoneTagFilter:[] AWSAssumeRole: AWSBatchChangeSize:1000 AWSBatchChangeInterval:1s AWSEvaluateTargetHealth:true AWSAPIRetries:3 AWSPreferCNAME:false AzureConfigFile:/etc/kubernetes/azure.json AzureResourceGroup: CloudflareProxied:false CloudflareZonesPerPage:50 CoreDNSPrefix:/skydns/ RcodezeroTXTEncrypt:false InfobloxGridHost: InfobloxWapiPort:443 InfobloxWapiUsername:admin InfobloxWapiPassword: InfobloxWapiVersion:2.3.1 InfobloxSSLVerify:true InfobloxView: InfobloxMaxResults:0 DynCustomerName: DynUsername: DynPassword: DynMinTTLSeconds:0 OCIConfigFile:/etc/kubernetes/oci.yaml InMemoryZones:[] PDNSServer:http://localhost:8081 PDNSAPIKey: PDNSTLSEnabled:false TLSCA: TLSClientCert: TLSClientCertKey: Policy:upsert-only Registry:txt TXTOwnerID:xxxxxxxxxxx-com TXTPrefix: Interval:5m0s Once:false DryRun:false LogFormat:text MetricsAddress::7979 LogLevel:debug TXTCacheInterval:0s ExoscaleEndpoint:https://api.exoscale.ch/dns ExoscaleAPIKey: ExoscaleAPISecret: CRDSourceAPIVersion:externaldns.k8s.io/v1alpha1 CRDSourceKind:DNSEndpoint ServiceTypeFilter:[] CFAPIEndpoint: CFUsername: CFPassword: RFC2136Host:10.10.40.2 RFC2136Port:53 RFC2136Zone:xxxxxxxx.com RFC2136Insecure:true RFC2136TSIGKeyName:rndc-key RFC2136TSIGSecret:****** RFC2136TSIGSecretAlg:hmac-md5 RFC2136TAXFR:true NS1Endpoint: NS1IgnoreSSL:false TransIPAccountName: TransIPPrivateKeyFile:} 
[0000] Created Kubernetes client https://10.43.0.1:443 
[0060] failed to sync cache: timed out waiting for the condition 

Any suggestion that can point me in the right direction ?

Thanks in advance

ppiccolo commented 5 years ago

Ok ... I can assume that it's not compatible with rancher2 and rancherOS, the problem is that it's unable to detect the cluster IP because in rancherOS there is nothing under the default kubernetes configuration folder.

At this point I suppose that the issue is more related with rancher stuff.

// NewKubeClient returns a new Kubernetes client object. It takes a Config and
// uses KubeMaster and KubeConfig attributes to connect to the cluster. If
// KubeConfig isn't provided it defaults to using the recommended default.
func NewKubeClient(kubeConfig, kubeMaster string, requestTimeout time.Duration) (*kubernetes.Clientset, error) {
    if kubeConfig == "" {
        if _, err := os.Stat(clientcmd.RecommendedHomeFile); err == nil {
            kubeConfig = clientcmd.RecommendedHomeFile
        }
    }

    config, err := clientcmd.BuildConfigFromFlags(kubeMaster, kubeConfig)
    if err != nil {
        return nil, err
    }

    config.WrapTransport = func(rt http.RoundTripper) http.RoundTripper {
        return instrumented_http.NewTransport(rt, &instrumented_http.Callbacks{
            PathProcessor: func(path string) string {
                parts := strings.Split(path, "/")
                return parts[len(parts)-1]
            },
        })
    }

    config.Timeout = requestTimeout

    client, err := kubernetes.NewForConfig(config)
    if err != nil {
        return nil, err
    }

    log.Infof("Created Kubernetes client %s", config.Host)

    return client, nil
}