"Error initializing Kubernetes metadata enricher"

When I run Metricbeat as a service on a Windows node of a Kubernetes cluster, I get multiple errors in the log:

ERROR util/kubernetes.go:106 Error initializing Kubernetes metadata enricher: unable to build kube config due to error: invalid configuration: no configuration has been provided

Metricbeat version 7.4.0, kubectl version 1.14.3.

What is wrong? What am I missing? What should I do to fix it?

metricbeat.yml
metricbeat.config.modules:
  path: ${path.config}/modules.d/*.yml
  reload.enabled: true
setup.template.settings:
  index.number_of_shards: 1
  index.codec: best_compression
setup.dashboards.enabled: false
setup.kibana:
  host: "172.30.0.52:5601"
output.elasticsearch:
  hosts: ["172.30.0.52:9200"]
processors:
  - add_host_metadata: ~
  - add_cloud_metadata: ~
logging.level: info
logging.files.path: 'C:\Program Files\metricbeat\logs'
kubernetes.yml
- module: kubernetes
  metricsets:
    - node
    - system
    - pod
    - container
    - volume
  period: 10s
  hosts: ["localhost:10250"]
system.yml
- module: system
  period: 10s
  metricsets:
    - cpu
    - memory
    - network
    - process
    - process_summary
  process.include_top_n:
    by_cpu: 5      # include top 5 processes by CPU
    by_memory: 5   # include top 5 processes by memory
- module: system
  period: 1m
  metricsets:
    - filesystem
    - fsstat
  processors:
  - drop_event.when.regexp:
      system.filesystem.mount_point: '^/(sys|cgroup|proc|dev|etc|host|lib)($|/)'
- module: system
  period: 15m
  metricsets:
    - uptime