-
Notifications
You must be signed in to change notification settings - Fork 717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fleet and elastic agent doesn't work without a ca.crt #4790
Comments
What we could do here is make the trust update script that we inject when running in Fleet mode conditional on the existence of the |
Yes, something like this would probably fix the problem. set +e
[[ -f /mnt/elastic-internal/elasticsearch-association/elastic0/elastic0/certs/ca.crt ]] && cp /mnt/elastic-internal/elasticsearch-association/elastic0/elastic0/certs/ca.crt /etc/pki/ca-trust/source/anchors/ \
&& update-ca-trust
set -e |
Hey @Raboo, thanks for the report. As you said, when Elasticsearch (and/or Kibana) Secret used for their TLS configuration doesn't contain Bug(s)There are two issues at play here, both are caused by not handling a scenario where Secret used by Kibana or Elasticsearch for TLS configuration don't contain
Fix
CA copying and Temporary workaroundThe issue can be avoided by copying containers:
- name: agent
volumeMounts:
- mountPath: /usr/share/elastic-agent/fleet-setup-base.yml
name: fleet-setup-config # this volume is added by ECK, we only need to change the mount
subPath: fleet-setup.yml
command:
- /usr/bin/env
- bash
- -c
- |
#!/usr/bin/env bash
set -e
grep -v "ca: /mnt/elastic-internal/.*\(elasticsearch\|kibana\).*" fleet-setup-base.yml > fleet-setup.yml
/usr/bin/tini -- /usr/local/bin/docker-entrypoint -e |
@david-kow Thanks, the work-around works. But now I hit the next problem with using a publicly trusted ca. Perhaps I should create a new issue for this? All the services provided by ECK defaults to internal hostnames.
But for all other services like kibana, beats and such I've been able to specify a different host for elasticsearch and kibana. config:
fleet_server:
elasticsearch:
host: https://elasticsearch0.k8s.mydomain.net:9200
kibana:
fleet:
host: https://kibana0.k8s.mydomain.net Also tried config:
fleet-setup:
fleet_server:
elasticsearch:
host: https://elasticsearch0.k8s.mydomain.net:9200
kibana:
fleet:
host: https://kibana0.k8s.mydomain.net None of these variants works and I haven't seen any syntax in the documentation. For example this works for beats config:
output:
elasticsearch:
hosts: https://elasticsearch0.k8s.mydomain.net:9200
setup:
kibana:
host: https://kibana0.k8s.mydomain.net:443 |
Hey @Raboo. The hosts for Kibana and Elasticsearch are initially coming from
env:
- name: FLEET_SERVER_ELASTICSEARCH_HOST
value: https://elasticsearch0.k8s.mydomain.net:9200
- name: KIBANA_FLEET_HOST
value: https://kibana0.k8s.mydomain.net:443
|
Awesome, that works |
Bug Report
*What did you do?
I have a elasticsearch + kibana deployment that uses Letsencrypt ACME certificate manged via cert-manager.
Deploying fleet server and elastic agent when using Letsencrypt ACME certificate manged via cert-manager doesn't work because the generated certificate secret doesn't contain a ca.crt and is expected by the current manifests. The tls.crt field in the cert-manager generated secrets contains the entire chain, from the leaf cert to the intermediate cert (not the root cert). cert-manager/cert-manager#1571 (comment)
What did you expect to see?
I expect fleet server and elastic agent to work without a private ca or self-signed tls setup.
I.e. to work with letsencrypt acme certificates generated with the help of cert-manager.
What did you see instead? Under which circumstances?
The pods fail to start because they are trying to copy ca.crt from a secret that doesn't have a ca.crt.
The pod manifest looks something like this
And startup fails with this message
Environment
The text was updated successfully, but these errors were encountered: