Skip to content
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

Additional info for leveraging this in kubernetes #15

Open
woodmicha opened this issue Jan 24, 2021 · 0 comments
Open

Additional info for leveraging this in kubernetes #15

woodmicha opened this issue Jan 24, 2021 · 0 comments

Comments

@woodmicha
Copy link

FIrst, I really appreciate you putting this repo together! I had some challenges getting the metrics from this container into my k8s based prometheus. I could curl the service and it was working fine but not showing up in prometheus.

After much searching found out you have to annotate your deployments for prometheus to discover them. I'm pasting my simple example below in hopes you can include this type of info in your README.md Perhaps this is common knowledge but my sense is this would help noobs like me get working faster.

Deployment.yaml

kind: Deployment
metadata:
  name: sqs-exporter
  labels:
    app: sqs-exporter
spec:
  replicas: 1
  selector:
    matchLabels:
      app: sqs-exporter
  template:
    metadata:
      labels:
        app: sqs-exporter
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/path: /metrics
        prometheus.io/port: "9384"
    spec:
      containers:
      - name: sqs-exporter
        image: jmal98/sqs-exporter
        ports:
        - containerPort: 9384
        env:
          - name: AWS_ACCESS_KEY_ID
            valueFrom:
              secretKeyRef:
                name: batch-iam
                key: access-key
          - name: AWS_SECRET_ACCESS_KEY
            valueFrom:
              secretKeyRef:
                name: batch-iam
                key: secret

service.yaml

apiVersion: v1
kind: Service
metadata:
  name: sqs-exporter
  labels:
    app: sqs-exporter
spec:
  selector:
    app: sqs-exporter
  ports:
  - protocol: TCP
    port: 9384
    targetPort: 9384
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

No branches or pull requests

1 participant