Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Environment Variables in config.yml are not resolved #70

Open
jlamande opened this issue Apr 11, 2021 · 1 comment
Open

Environment Variables in config.yml are not resolved #70

jlamande opened this issue Apr 11, 2021 · 1 comment

Comments

@jlamande
Copy link

Hi,

I created a config.yml file based on the default configuration in the README.md page using :

rules:
  - clusters:
      - $CCLOUD_CLUSTER

On metrics fetch, I see errors as

Received status code 403 instead of 200 for POST on https://api.telemetry.confluent.cloud//v2/metrics/cloud/query ({\"errors\":[{\"status\":\"403\",\"detail\":\"Query must filter by at least one of your authorized resources

Running with docker-compose, I exec a shell in the ccloud_exporter and display environment variables :

$ env
...
CCLOUD_CLUSTER=lkc-xxxx1
...

When I set the real value (lkc-xxxx1) instead of the environment variable $CCLOUD_CLUSTER, metrics are correctly fetched on the cluster.

@satheshs
Copy link

satheshs commented Sep 8, 2021

We are getting the same kind of error when we are deploying in the kubernetes. Below mention the steps we have followed.

xxxxx@xxxxx-Subxxxxxx kubernetes % make install
kubectl create ns ccloudexporter
namespace/ccloudexporter created

kubectl -n ccloudexporter create secret generic "xxxxxxxxxxxxxxx"-vars --from-literal=CCLOUD_API_KEY="xxxxxxxxxxxxxxx" --from-literal=CCLOUD_API_SECRET="xxxxxxxxxxxxxxxxxxxxxxxxxx" --from-literal=CCLOUD_CLUSTER="xxxxxxxxxxxxxx" ;
secret/xxxxxxxxxxxxxxx-vars created

sed "s/#{cluster}#/"xxxxxxxxxxxxxxx"/g" ccloudexporter.dp.yaml | kubectl -n ccloudexporter apply --record -f - ;
deployment.apps/xxxxxxxxxxxxxxx-dp created

sed "s/#{cluster}#/"xxxxxxxxxxxxxxx"/g" ccloudexporter.svc.yaml | kubectl -n ccloudexporter apply --record -f - ;
service/xxxxxxxxxxxxxxx-svc created

kubectl -n monitoring apply --record -f ccloudexporter.crd.yaml

servicemonitor.monitoring.coreos.com/ccloudexporter unchanged
xxxxx@xxxxx-Subxxxxxx kubernetes % kubectl get all -n ccloudexporter

NAME READY STATUS RESTARTS AGE
pod/lkc-xxxxx-dp-654cd5d595-9cjp4 0/1 CrashLoopBackOff 1 19s

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/lkc-xxxxx-svc ClusterIP 10.0.180.249 2112/TCP 15s

NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/lkc-xxxxx-dp 0/1 1 0 19s

NAME DESIRED CURRENT READY AGE
replicaset.apps/lkc-xxxxx-dp-654cd5d595 1 1 0 20s
xxxxx@xxxxx-Subxxxxxx kubernetes % kubectl logs pod/lkc-xxxxx-dp-654cd5d595-9cjp4 -n ccloudexporter
{
"Endpoint": "https://api.telemetry.confluent.cloud/v2/metrics/cloud/descriptors/resources",
"StatusCode": 403,
"body": "eyJlcnJvceeeeiI6eyJjbeeee2RlIjo0MDMsIm1lc3xxeNhZ2UiOiJcjncehrpbnZhbGlkIEFQSSBrZXkifX0K",
"level": "fatal",
"msg": "Received status code 403 instead of 200 for GET on https://api.telemetry.confluent.cloud/v2/metrics/cloud/descriptors/resources. \n\n{"error":{"code":403,"message":"invalid API key"}}\n\n\n",
"time": "2021-09-08T19:23:53Z"
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants