0

I am trying to deploy the standard OTel Collector Contrib Docker image to Cloud Foundry.

Following OTel's documentation of how to configure the collector I am trying to inject the OTel collector's configurations via an environment variable by specifying the following:

--config=env:MY_CONFIG_IN_AN_ENVVAR

In order to do that, I need to override the OTel Collector image's start command (CMD) as documented in the Cloud Foundry documentation, and I am using a CF manifest.yaml file to do so.

The original CMD in the image is given as:

CMD ["--config" "/etc/otelcol-contrib/config.yaml"]

So I thought, I'd start by overriding CMD with its original value, just to test, if overriding works at all. Here is the according manifest.yaml:

applications:
- name: occ
  memory: 256M
  disk_quota: 512M
  instances: 1
  health-check-type: process
  docker:
    image: otel/opentelemetry-collector-contrib:0.114.0
  command: "--config=/etc/otelcol-contrib/config.yaml"
    
  routes: 
  - route: occ.some.domain.com
    protocol: http2

When I cf push that docker image, deployment fails with the following error:

   2024-11-21T23:15:07.83+0100 [CELL/0] OUT Cell 36978039-f310-488f-84df-e717cacf7f21 stopping instance c8b25623-18ad-48be-76f0-fe2c
   2024-11-21T23:15:07.83+0100 [CELL/0] OUT Cell 36978039-f310-488f-84df-e717cacf7f21 destroying container for instance c8b25623-18ad-48be-76f0-fe2c
   2024-11-21T23:15:07.83+0100 [API/36] OUT Process has crashed with type: "web"
   2024-11-21T23:15:07.85+0100 [API/36] OUT App instance exited with guid 1b878955-8f60-4c17-ba79-ed642b842fe5 payload: {"instance"=>"c8b25623-18ad-48be-76f0-fe2c", "index"=>0, "cell_id"=>"36978039-f310-488f-84df-e717cacf7f21", "reason"=>"CRASHED", "exit_description"=>"APP/PROC/WEB: Exited with status 1", "crash_count"=>1, "crash_timestamp"=>1732227307824196148, "version"=>"495c31ed-0cd1-4120-961b-3d9add207828"}
   2024-11-21T23:15:07.87+0100 [CELL/0] OUT Cell 55878f2d-faab-4a94-96ba-ffe97bd7e165 creating container for instance e3175892-6acc-4b7a-4e4c-2d3e
   2024-11-21T23:15:08.22+0100 [PROXY/0] OUT Exit status 137
   2024-11-21T23:15:08.87+0100 [CELL/0] OUT Cell 36978039-f310-488f-84df-e717cacf7f21 successfully destroyed container for instance c8b25623-18ad-48be-76f0-fe2c
   2024-11-21T23:15:12.27+0100 [CELL/0] OUT Security group rules were updated
   2024-11-21T23:15:12.34+0100 [CELL/0] OUT Cell 55878f2d-faab-4a94-96ba-ffe97bd7e165 successfully created container for instance e3175892-6acc-4b7a-4e4c-2d3e
   2024-11-21T23:15:12.71+0100 [APP/PROC/WEB/0] OUT Exit status 1
   2024-11-21T23:15:12.71+0100 [APP/PROC/WEB/0] ERR Failed to run: no such file or directory
   2024-11-21T23:15:12.71+0100 [CELL/SSHD/0] OUT Exit status 0

If I deploy without the command override, the image starts perfectly fine.

What could be the problem?

2
  • I'm unfamiliar with Cloud Foundry but often (!?) configs like this use command to represent the entrypoint and args (an array) for args|flags. It's possible this is true for Cloud Foundry and you're unintentionally overriding the entrypoint (/otelcol-contrib). Could you try (a) prefixing your /otelcol-contrib --config=...; (b) using args (usually an array) instead for --config=...; (c) you may need a combo of both; (d) provide a link to the spec for applications Commented Nov 21, 2024 at 23:14
  • Thanks for your reply. I already tried prefixing the /otelcol-contrib binary, since I had the same idea, but that did not work either. args is not used by this image but I would not be able to override that anyway, since CF only allows overriding CMD (via the command property). The YAML spec to the applications node is here. Commented Nov 21, 2024 at 23:23

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.