Kibana Error After Connecting Node to a Cluster

I originally had a single-node cluster set on machine 1, and everything was working fine. Then I tried to add another node to the cluster on machine 2 in the local area network. I had started elasticsearch on machine 2 before so it had another cluster id and couldn't connect at first, so I removed the contents of the data folder on machine 2, and then it was able to connect the cluster. But now when I start Kibana on machine 1, it gives me the following error:

[error][savedobjects-service] Unable to retrieve version information from Elasticsearch nodes.

I don't know if this is related to me deleting the data folder contents from machine 2. These are the elasticsearch.yml files from node 1 and node 2:

node 1:

cluster.name: my-cluster
node.name: node-1
network.host: 192.168.1.10
node.master: true
node.data: true
discovery.zen.ping.unicast.hosts: ["192.168.1.10", "192.168.1.8"]
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.client_authentication: required
xpack.security.transport.ssl.keystore.path: elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: elastic-certificates.p12

node 2:

cluster.name: my-cluster
node.name: node-2
network.host: 192.168.1.8
node.master: false
node.data: true
discovery.zen.ping.unicast.hosts: ["192.168.1.10", "192.168.1.8"]
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.client_authentication: required
xpack.security.transport.ssl.keystore.path: elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: elastic-certificates.p12

The following is the kibana.yml file for node 1:

elasticsearch.hosts: ["http://localhost:9200"]
elasticsearch.username: "kibana_system"

Does anyone know how I can fix this issue?

What version are you running?