Warning messages in kibana - not connecting to elasticsearch

elasticsearch and kibana seems to be working but kibana cannot connect to elasticsearch

# systemctl status kibana
● kibana.service - Kibana
   Loaded: loaded (/usr/lib/systemd/system/kibana.service; enabled; vendor pres>
   Active: active (running) since Mon 2025-03-17 14:04:52 CET; 1h 16min ago
     Docs: https://www.elastic.co
 Main PID: 3376445 (node)
    Tasks: 11 (limit: 49465)
   Memory: 464.4M
   CGroup: /system.slice/kibana.service
           └─3376445 /usr/share/kibana/bin/../node/glibc-217/bin/node /usr/shar>

Mar 17 14:05:06 ibcinsmartsd12v kibana[3376445]: [2025-03-17T14:05:06.785+01:00>
Mar 17 14:05:06 ibcinsmartsd12v kibana[3376445]: [2025-03-17T14:05:06.874+01:00>
Mar 17 14:05:07 ibcinsmartsd12v kibana[3376445]: [2025-03-17T14:05:07.439+01:00>
Mar 17 14:05:07 ibcinsmartsd12v kibana[3376445]: [2025-03-17T14:05:07.441+01:00>
Mar 17 14:05:10 ibcinsmartsd12v kibana[3376445]: [2025-03-17T14:05:10.165+01:00
systemctl status elasticsearch
● elasticsearch.service - Elasticsearch
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vend>
   Active: active (running) since Mon 2025-03-17 10:19:51 CET; 5h 2min ago
     Docs: https://www.elastic.co
 Main PID: 3346193 (java)
    Tasks: 111 (limit: 49465)
   Memory: 3.4G
   CGroup: /system.slice/elasticsearch.service
           ├─3346193 /usr/share/elasticsearch/jdk/bin/java -Xms4m -Xmx64m -XX:+>
           ├─3346257 /usr/share/elasticsearch/jdk/bin/java -Des.networkaddress.>
           └─3346279 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux->


 tail -f kibana.log | grep WARN
{"service":{"node":{"roles":["background_tasks","ui"]}},"ecs":{"version":"8.11.0"},"@timestamp":"2025-03-17T14:05:06.785+01:00","message":"APIs are disabled because the Encrypted Saved Objects plugin is missing encryption key. Please set xpack.encryptedSavedObjects.encryptionKey in the kibana.yml or use the bin/kibana-encryption-keys command.","log":{"level":"WARN","logger":"plugins.actions"},"process":{"pid":3376445,"uptime":14.095067308},"trace":{"id":"4b293a54eec524ad9e2a35ecb0b128cd"},"transaction":{"id":"e15971d1522d4b71"}}
{"service":{"node":{"roles":["background_tasks","ui"]}},"ecs":{"version":"8.11.0"},"@timestamp":"2025-03-17T14:05:07.439+01:00","message":"APIs are disabled because the Encrypted Saved Objects plugin is missing encryption key. Please set xpack.encryptedSavedObjects.encryptionKey in the kibana.yml or use the bin/kibana-encryption-keys command.","log":{"level":"WARN","logger":"plugins.alerting"},"process":{"pid":3376445,"uptime":14.750002086},"trace":{"id":"4b293a54eec524ad9e2a35ecb0b128cd"},"transaction":{"id":"e15971d1522d4b71"}}
{"service":{"node":{"roles":["background_tasks","ui"]}},"ecs":{"version":"8.11.0"},"@timestamp":"2025-03-17T14:05:10.165+01:00","message":"Generating a random key for xpack.reporting.encryptionKey. To prevent sessions from being invalidated on restart, please set xpack.reporting.encryptionKey in the kibana.yml or use the bin/kibana-encryption-keys command.","log":{"level":"WARN","logger":"plugins.reporting.config"},"process":{"pid":3376445,"uptime":17.475644295},"trace":{"id":"4b293a54eec524ad9e2a35ecb0b128cd"},"transaction":{"id":"e15971d1522d4b71"}}

My kibana.yml file

#elasticsearch.ssl.certificate: /path/to/your/client.crt
#elasticsearch.ssl.key: /path/to/your/client.key

# Enables you to specify a path to the PEM file for the certificate
# authority for your Elasticsearch instance.
#elasticsearch.ssl.certificateAuthorities: [ "/path/to/your/CA.pem" ]

# To disregard the validity of SSL certificates, change this setting's value to 'none'.
elasticsearch.ssl.verificationMode: none

# =================== System: Logging ===================
# Set the value of this setting to off to suppress all logging output, or to debug to log everything. Defaults to 'info'
#logging.root.level: debug

# Enables you to specify a file where Kibana stores log output.
logging:
  appenders:
    file:
      type: file
      fileName: /var/log/kibana/kibana.log
      layout:
        type: json
  root:
    appenders:
      - default
      - file
#  policy:
#    type: size-limit
#    size: 256mb
#  strategy:
#    type: numeric
#    max: 10
#  layout:
#    type: json

# Logs queries sent to Elasticsearch.
#logging.loggers:
#  - name: elasticsearch.query
#    level: debug

# Logs http responses.
#logging.loggers:
#  - name: http.server.response

 curl --cacert /etc/elasticsearch/certs/http_ca.crt -u elastic:xxxxxxxx https://localhost:9200
{
  "name" : "ibcinsmartsd12v",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "oDcQEF_jQTiJjESJnLlpPQ",
  "version" : {
    "number" : "8.17.3",
    "build_flavor" : "default",
    "build_type" : "rpm",
    "build_hash" : "a091390de485bd4b127884f7e565c0cad59b10d2",
    "build_date" : "2025-02-28T10:07:26.089129809Z",
    "build_snapshot" : false,
    "lucene_version" : "9.12.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"

key bit here is IMO

To prevent sessions from being invalidated on restart ...

So, did you follow the advice

please set xpack.reporting.encryptionKey in the kibana.yml or use the bin/kibana-encryption-keys command

btw, Im not sure what "working" means if kibana cannot connect to elasticsearch - I would call that "not working" personally.