Skip to content

Use agent docker image #10

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

Merged
merged 8 commits into from
May 7, 2020
Merged

Conversation

mtojek
Copy link
Contributor

@mtojek mtojek commented May 6, 2020

This PR adds support for Elastic Agent image.

Docker-compose allows for scaling agent instances.

screencapture-localhost-5601-app-ingestManager-2020-05-06-16_55_56

@mtojek mtojek requested a review from ruflin May 6, 2020 14:59
@mtojek mtojek self-assigned this May 6, 2020
Copy link
Contributor

@ruflin ruflin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not get this working on my end. In Kibana I get:

request to http://package-registry:8080/search?package=base&internal=true failed, reason: getaddrinfo ENOTFOUND package-registry package-registry:8080

And in the logs I see:

elastic-agent_1     | fail to enroll: fail to execute request to Kibana: Status code: 401, Kibana returned an error: Unauthorized, message: [security_exception] missing authentication credentials for REST request [/_security/_authenticate], with { header={ WWW-Authenticate={ 0="ApiKey" & 1="Basic realm=\"security\" charset=\"UTF-8\"" } } }
environments_elastic-agent_1 exited with code 1

version: '2.3'
services:
elastic-agent:
image: docker.elastic.co/observability-ci/elastic-agent:8.0.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kuisathaverat Can we make this image public?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not get this working on my end. In Kibana I get:

request to http://package-registry:8080/search?package=base&internal=true failed, reason: getaddrinfo ENOTFOUND package-registry package-registry:8080

And in the logs I see:

elastic-agent_1     | fail to enroll: fail to execute request to Kibana: Status code: 401, Kibana returned an error: Unauthorized, message: [security_exception] missing authentication credentials for REST request [/_security/_authenticate], with { header={ WWW-Authenticate={ 0="ApiKey" & 1="Basic realm=\"security\" charset=\"UTF-8\"" } } }
environments_elastic-agent_1 exited with code 1

Did you take down all running containers? It looks like it referred to not existing one.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, we can make it public, Which namespace you want to push it?

... or with Elastic Agent:

```bash
$ docker-compose -f snapshot.yml -f local.yml -f agent.yml up --force-recreate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First time I run this I got:

Creating environments_package-registry_1 ... done
Creating environments_elasticsearch_1    ... done

ERROR: for kibana  Container "82665ad5fd87" is unhealthy.
ERROR: Encountered errors while bringing up the project.

I assume the timeout was too low.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm.. you can try to wipe out docker images. Anyway, this one is weird. If it's not a one-time issue, would be good to reproduce it.

... or with Elastic Agent:

```bash
$ docker-compose -f snapshot.yml -f local.yml -f agent.yml up --force-recreate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to have a mage command for this, easier to remember (at least for me).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well it all depends what do you need, either entire fleet with enrolled agent or you prefer to keep the agent aside on your host.

I can add one or two default mage targets, but it will limit configurability of available docker-compose options.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets wait with it and see what most of us use frequently.

@mtojek
Copy link
Contributor Author

mtojek commented May 7, 2020

I noticed other issue. I don't see any metricbeat and filebeat processes running:

[root@0c60bbe45399 elastic-agent]# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.1 559748 15772 ?        Ssl  08:39   0:00 elastic-agent run
root       190  0.0  0.0  11836  2908 pts/0    Ss   08:40   0:00 /bin/bash
root       241  0.0  0.0  51760  3528 pts/0    R+   08:51   0:00 ps aux

@michalpristas does it look like a bug or should I enable something else?

@michalpristas
Copy link
Contributor

depends on a config, can you get a config retrieved?
./elastic-agent inspect

@mtojek
Copy link
Contributor Author

mtojek commented May 7, 2020

depends on a config, can you get a config retrieved?
./elastic-agent inspect

[root@0c60bbe45399 elastic-agent]# ./elastic-agent inspect
Error: unknown command "inspect" for "elastic-agent"
Run 'elastic-agent --help' for usage.
unknown command "inspect" for "elastic-agent"

Does it mean the agent docker image is not published on regular basis?

-rwxr-x--- 1 root elastic-agent 21907211 Apr 28 11:48 elastic-agent

@michalpristas
Copy link
Contributor

michalpristas commented May 7, 2020

this seems rather old
i will test in on my end as well but i need to do some testing on 7.x today

^^ @kuisathaverat how often is docker image published?

@ruflin
Copy link
Contributor

ruflin commented May 7, 2020

There is also docker.elastic.co/beats/elastic-agent:8.0.0-SNAPSHOT, I wonder if this helps.

@kuisathaverat
Copy link
Contributor

kuisathaverat commented May 7, 2020

^^ @kuisathaverat how often is docker image published?

we push with every correct merge to master, 7.x, and 7.7 to docker.elastic.co/observability-ci/elastic-agent:BRANCH_NAME and docker.elastic.co/observability-ci/elastic-agent:SHA1 you can check the images at https://container-library.elastic.co/r/observability-ci/elastic-agent

This namespace is private, if you need them on public we can make it

@mtojek
Copy link
Contributor Author

mtojek commented May 7, 2020

@michalpristas @ruflin ^

any suggestions regarding the public namespace/project? "beats/elastic-agent"?

BTW It would great to clean all other namespaces from old agent's images.

@kuisathaverat
Copy link
Contributor

BTW It would great to clean all other namespaces from old agent's images.

we do not have permission we will open an infra issue for that.

@ruflin
Copy link
Contributor

ruflin commented May 7, 2020

@kuisathaverat How is this different from docker.elastic.co/beats/elastic-agent:8.0.0-SNAPSHOT?

@kuisathaverat
Copy link
Contributor

Those images (docker.elastic.co/beats/elastic-agent:8.0.0-SNAPSHOT) are released by the snapshot process from the RElease team, they are generated once a day

@ruflin
Copy link
Contributor

ruflin commented May 7, 2020

But the content of the file is the same? My assumption would be for the use case here from @mtojek once a day should normally be enough?

@mtojek
Copy link
Contributor Author

mtojek commented May 7, 2020

But the content of the file is the same? My assumption would be for the use case here from @mtojek once a day should normally be enough?

Absolutely, it works for me.

Copy link
Contributor

@ruflin ruflin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Figured out why it didn't work. I had a fresh checkout of the repo and never run mage build so the registry stopped because of no packages.

@mtojek
Copy link
Contributor Author

mtojek commented May 7, 2020

Figured out why it didn't work. I had a fresh checkout of the repo and never run mage build so the registry stopped because of no packages.

I added a hint to the README.

@mtojek mtojek merged commit 9df9ae5 into elastic:master May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants