Hello wonderful people,
I'm looking into setting up fleet. So far I have a test server ready and I have generated the certificates using Elasticsearch-certutil
Elasticsearch CA
/etc/Elasticsearch/certs/elastic-stack-ca.p12
Elasticsearch certificate
/etc/Elasticsearch/certs/elastic-certificates.p12
# Kibana certs
# EXPORT CA Certificate
mkdir /etc/kibana/certs
openssl pkcs12 -in /etc/elasticsearch/certs/elastic-stack-ca.p12 -clcerts -nokeys -chain -out /etc/kibana/certs/ca.pem
chmod 640 /etc/kibana/certs/ca.pem
# EXPORT Cert and Key for Kibana
/usr/share/elasticsearch/bin/elasticsearch-certutil cert --pem --ca /etc/elasticsearch/certs/elastic-stack-ca.p12 --dns localhost,"$cluster_name" --ip 127.0.0.1,"$ip_address" --out /etc/kibana/certs/kibana.zip
unzip -j /etc/kibana/certs/kibana.zip -d /etc/kibana/certs/
After unzipping I have the following:
# cert authority
ca.pem
# server certificate
instance.crt
# server certificate key
instance.key
Would I be able to use the certificates above for fleet?
I have tried using the following command to start the fleet server but it fails
sudo elastic-agent enroll --url=https://192.168.131.155:8200 --fleet-server-es=https://192.168.131.155:9200 --fleet-server-service-token=hidden --fleet-server-policy=hidden --certificate-authorities=/etc/kibana/ca.pem --fleet-server-es-ca=/etc/kibana/ca.pem --fleet-server-cert=/etc/kibana/certs/instance.crt --fleet-server-cert-key=/etc/kibana/certs/instance.key
This will replace your current settings. Do you want to continue? [Y/n]:y
2022-01-14T19:21:49.758+1100 INFO cmd/enroll_cmd.go:571 Spawning Elastic Agent daemon as a subprocess to complete bootstrap process.
2022-01-14T19:21:49.910+1100 INFO application/application.go:67 Detecting execution mode
2022-01-14T19:21:49.911+1100 INFO application/application.go:88 Agent is in Fleet Server bootstrap mode
2022-01-14T19:21:50.034+1100 INFO [api] api/server.go:62 Starting stats endpoint
2022-01-14T19:21:50.034+1100 INFO application/fleet_server_bootstrap.go:130 Agent is starting
2022-01-14T19:21:50.034+1100 INFO [api] api/server.go:64 Metrics endpoint listening on: /var/lib/elastic-agent/data/tmp/elastic-agent.sock (configured: unix:///var/lib/elastic-agent/data/tmp/elastic-agent.sock)
2022-01-14T19:21:50.036+1100 INFO application/fleet_server_bootstrap.go:140 Agent is stopped
2022-01-14T19:21:50.038+1100 INFO stateresolver/stateresolver.go:48 New State ID is HqKuFOSV
2022-01-14T19:21:50.038+1100 INFO stateresolver/stateresolver.go:49 Converging state requires execution of 1 step(s)
2022-01-14T19:21:50.080+1100 INFO operation/operator.go:284 operation 'operation-install' skipped for fleet-server.7.16.3
2022-01-14T19:21:50.357+1100 INFO log/reporter.go:40 2022-01-14T19:21:50+11:00 - message: Application: fleet-server--7.16.3[]: State changed to STARTING: Starting - type: 'STATE' - sub_type: 'STARTING'
2022-01-14T19:21:50.357+1100 INFO stateresolver/stateresolver.go:66 Updating internal state
2022-01-14T19:21:50.760+1100 INFO cmd/enroll_cmd.go:776 Fleet Server - Starting
2022-01-14T19:21:50.890+1100 INFO log/reporter.go:40 2022-01-14T19:21:50+11:00 - message: Application: fleet-server--7.16.3[]: State changed to RESTARTING: exited with code: 1 - type: 'STATE' - sub_type: 'STARTING'
2022-01-14T19:21:50.890+1100 INFO log/reporter.go:40 2022-01-14T19:21:50+11:00 - message: Application: fleet-server--7.16.3[]: State changed to STARTING: Starting - type: 'STATE' - sub_type: 'STARTING'
2022-01-14T19:21:50.890+1100 INFO log/reporter.go:40 2022-01-14T19:21:50+11:00 - message: Application: fleet-server--7.16.3[]: State changed to RESTARTING: Restarting - type: 'STATE' - sub_type: 'STARTING'
2022-01-14T19:21:51.417+1100 INFO log/reporter.go:40 2022-01-14T19:21:51+11:00 - message: Application: fleet-server--7.16.3[]: State changed to STARTING: Starting - type: 'STATE' - sub_type: 'STARTING'
2022-01-14T19:22:55.048+1100 WARN status/reporter.go:236 Elastic Agent status changed to: 'degraded'
2022-01-14T19:22:55.048+1100 INFO log/reporter.go:40 2022-01-14T19:22:55+11:00 - message: Application: fleet-server--7.16.3[]: State changed to DEGRADED: Missed last check-in - type: 'STATE' - sub_type: 'RUNNING'
2022-01-14T19:23:49.760+1100 INFO cmd/run.go:184 Shutting down Elastic Agent and sending last events...
2022-01-14T19:23:49.761+1100 INFO operation/operator.go:216 waiting for installer of pipeline 'default' to finish
2022-01-14T19:23:49.761+1100 INFO process/app.go:176 Signaling application to stop because of shutdown: fleet-server--7.16.3
2022-01-14T19:23:55.056+1100 ERROR status/reporter.go:236 Elastic Agent status changed to: 'error'
2022-01-14T19:23:55.056+1100 ERROR log/reporter.go:36 2022-01-14T19:23:55+11:00 - message: Application: fleet-server--7.16.3[]: State changed to FAILED: Missed two check-ins - type: 'ERROR' - sub_type: 'FAILED'
2022-01-14T19:24:20.801+1100 INFO status/reporter.go:236 Elastic Agent status changed to: 'online'
2022-01-14T19:24:20.801+1100 INFO log/reporter.go:40 2022-01-14T19:24:20+11:00 - message: Application: fleet-server--7.16.3[]: State changed to STOPPED: Stopped - type: 'STATE' - sub_type: 'STOPPED'
2022-01-14T19:24:20.801+1100 INFO cmd/run.go:192 Shutting down completed.
2022-01-14T19:24:20.801+1100 INFO [api] api/server.go:66 Stats endpoint (/var/lib/elastic-agent/data/tmp/elastic-agent.sock) finished: accept unix /var/lib/elastic-agent/data/tmp/elastic-agent.sock: use of closed network connection
Error: fleet-server failed: context canceled
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/7.16/fleet-troubleshooting.html
Thank you