kubernetes-sigs / external-dns

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

DNSEnpoint CRD: the server could not find the requested resource #707

Closed bartelsielski closed 6 years ago

bartelsielski commented 6 years ago

When using the new DNSEndpoint CRD, external-dns continuously logs the server could not find the requested resource. The DNS records defined in the CRDs are correctly created.

Full logs:

time="2018-09-13T10:28:52Z" level=info msg="config: {Master: KubeConfig: RequestTimeout:30s IstioIngressGateway:istio-system/istio-ingressgateway Sources:[crd] Namespace: AnnotationFilter: FQDNTemplate: CombineFQDNAndAnnotation:false Compatibility: PublishInternal:false PublishHostIP:false ConnectorSourceServer:localhost:8080 Provider:inmemory GoogleProject: DomainFilter:[] ZoneIDFilter:[] AlibabaCloudConfigFile:/etc/kubernetes/alibaba-cloud.json AlibabaCloudZoneType: AWSZoneType: AWSAssumeRole: AWSMaxChangeCount:4000 AWSEvaluateTargetHealth:true AzureConfigFile:/etc/kubernetes/azure.json AzureResourceGroup: CloudflareProxied:false InfobloxGridHost: InfobloxWapiPort:443 InfobloxWapiUsername:admin InfobloxWapiPassword: InfobloxWapiVersion:2.3.1 InfobloxSSLVerify:true 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:testing-crd TXTPrefix: Interval:1m0s 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:[]}"
time="2018-09-13T10:28:52Z" level=info msg="Created Kubernetes client https://10.96.0.1:443"
time="2018-09-13T10:28:52Z" level=warning msg="Could not update ObservedGeneration of the CRD: the server could not find the requested resource (put dnsendpoints.externaldns.k8s.io examplednsrecord)"
time="2018-09-13T10:28:52Z" level=info msg="CREATE: hello.example.com 180 IN A 127.0.0.1"
time="2018-09-13T10:28:52Z" level=info msg="CREATE: hello.example.com 0 IN TXT \"heritage=external-dns,external-dns/owner=testing-crd\""
time="2018-09-13T10:29:52Z" level=warning msg="Could not update ObservedGeneration of the CRD: the server could not find the requested resource (put dnsendpoints.externaldns.k8s.io examplednsrecord)"
time="2018-09-13T10:29:52Z" level=info msg="CREATE: hello.example.com 180 IN A 127.0.0.1"
time="2018-09-13T10:29:52Z" level=info msg="CREATE: hello.example.com 0 IN TXT \"heritage=external-dns,external-dns/owner=testing-crd\""


Using minikube version v0.28.2 (default configuration). The cluster is set up with the following configuration:

RBAC yaml

```yaml apiVersion: v1 kind: ServiceAccount metadata: name: external-dns --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRoleBinding metadata: name: external-dns roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: external-dns subjects: - kind: ServiceAccount name: external-dns namespace: default --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRole metadata: labels: app: external-dns heritage: Tiller release: external-dns chart: external-dns-0.7.6 name: external-dns rules: - apiGroups: - "" - extensions resources: - ingresses - services - pods - nodes verbs: - get - list - watch - apiGroups: - externaldns.k8s.io resources: - '*' verbs: - get - list - watch - apiGroups: - externaldns.k8s.io resources: - dnsendpoints/status verbs: - '*' ```

DNSEndpoint custom resource definition yaml

```yaml apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: dnsendpoints.externaldns.k8s.io labels: api: externaldns spec: version: v1alpha1 group: externaldns.k8s.io names: kind: DNSEndpoint plural: dnsendpoints scope: Namespaced subresources: status: {} validation: openAPIV3Schema: properties: apiVersion: type: string kind: type: string metadata: type: object spec: type: object properties: endpoints: type: array items: type: object properties: dnsName: type: string labels: type: object providerSpecific: type: object recordTTL: type: integer format: int64 recordType: type: string targets: type: array items: type: string status: type: object properties: observedGeneration: format: int64 type: integer ```

DNSEndpoint example record yaml

```yaml apiVersion: externaldns.k8s.io/v1alpha1 kind: DNSEndpoint metadata: name: examplednsrecord spec: endpoints: - dnsName: hello.example.com recordTTL: 180 recordType: A targets: - 127.0.0.1 ```


external-dns is installed using helm with the following values:

Helm values yaml

```yaml provider: inmemory sources: - crd extraArgs: crd-source-apiversion: externaldns.k8s.io/v1alpha1 rbac: create: false serviceAccountName: external-dns txtOwnerId: testing-crd logLevel: debug ```


danehans commented 6 years ago

@bartelsielski I ran into the same issue as you. Did you figure out a workaround?

/cc @shashidharatd

bartelsielski commented 6 years ago

@danehans As far as I've tested (which isn't that far), DNS records defined in the CRDs still get created. The status field of the CRD object just won't get updated. So a possible workaround could be to just ignore the warning (I haven't done any in depth testing so this might not be a viable workaround in the long run).

hodduc commented 6 years ago

In my case, I also ran into this issue, and I found that "CustomResourceSubresources" feature gate was set to default ("false") in my cluster. I set this to "true" and re-created CRD, then created CR again, then everything works.

ingvagabund commented 6 years ago

minikube v0.28.2 still deploys kubernets v1.10. Try:

minikube start --kubernetes-version v1.11.3
bartelsielski commented 6 years ago

So I verified both solutions mentioned above:

Thanks for the help guys.