Giter Club home page Giter Club logo

Comments (8)

blakelead avatar blakelead commented on June 7, 2024

Hi @bjethwan,
I don't know, I didn't try it with Prometheus Operator but I'll be glad to have your feedback on this matter!

from couchbase_exporter.

LilaNKM avatar LilaNKM commented on June 7, 2024

Hello :) To use it in Kubernetes I create a Helm chart with the docker image precise in values.yaml
Helm create blakelead-couchbase_exporter

image:
  repository: blakelead/couchbase-exporter
  pullPolicy: IfNotPresent

I have some difficulties to field environment variable in values.yaml

extraEnv:
  - name: CB_EXPORTER_DB_USER
    value: customadmin
  - name: CB_EXPORTER_DB_PASSWORD
    value: custompasword
  - db.uri: http://couchbase:8091   # The db uir take the name of the kubernetes couchbase service

I Try many ways, but once deploy the chart still use default values

 kubectl logs blakelead-exporter-couchbase
time="2020-09-18T14:53:55Z" level=info msg="Couchbase Exporter Version: 0.9.0"
time="2020-09-18T14:53:55Z" level=info msg="config.file="
time="2020-09-18T14:53:55Z" level=info msg="web.listen-address=127.0.0.1:9191"
time="2020-09-18T14:53:55Z" level=info msg="web.telemetry-path=/metrics"
time="2020-09-18T14:53:55Z" level=info msg="web.timeout=10s"
**time="2020-09-18T14:53:55Z" level=info msg="db.uri=http://localhost:8091"**
time="2020-09-18T14:53:55Z" level=info msg="db.timeout=10s"
time="2020-09-18T14:53:55Z" level=info msg="tls.skip-insecure=false"
time="2020-09-18T14:53:55Z" level=info msg="tls.ca-cert="
time="2020-09-18T14:53:55Z" level=info msg="tls.enabled=false"
time="2020-09-18T14:53:55Z" level=info msg="tls.client-cert="
time="2020-09-18T14:53:55Z" level=info msg="tls.client-key="
time="2020-09-18T14:53:55Z" level=info msg="log.level=info"
time="2020-09-18T14:53:55Z" level=info msg="log.format=text"
time="2020-09-18T14:53:55Z" level=info msg="scrape.cluster=true"
time="2020-09-18T14:53:55Z" level=info msg="scrape.node=true"
time="2020-09-18T14:53:55Z" level=info msg="scrape.bucket=true"
time="2020-09-18T14:53:55Z" level=info msg="scrape.xdcr=true"
time="2020-09-18T14:53:55Z" level=info msg="Cluster exporter registered"
time="2020-09-18T14:53:55Z" level=info msg="Node exporter registered"
time="2020-09-18T14:53:55Z" level=info msg="Bucket exporter registered"
time="2020-09-18T14:53:55Z" level=info msg="Bucketstats exporter registered"
time="2020-09-18T14:53:55Z" level=info msg="XDCR exporter registered"
time="2020-09-18T14:53:55Z" level=info msg="Started listening at 127.0.0.1:9191"

from couchbase_exporter.

blakelead avatar blakelead commented on June 7, 2024

Hi @LilaNKM ,
Could you provide a link to your chart? Or if not possible the values.yaml along with the templates?
Also, could you please create a dedicated issue?

Thanks :)

from couchbase_exporter.

LilaNKM avatar LilaNKM commented on June 7, 2024

The chart is create with helm create command.

helm create blakelead-exporter

I change 3 files in it.

values.yaml

# Default values for blakelead-exporter.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1

image:
  repository: blakelead/couchbase-exporter
  pullPolicy: IfNotPresent

imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

serviceAccount:
  # Specifies whether a service account should be created
  create: true
  # The name of the service account to use.
  # If not set and create is true, a name is generated using the fullname template
  name:

podSecurityContext: {}
  # fsGroup: 2000

securityContext: {}
  # capabilities:
  #   drop:
  #   - ALL
  # readOnlyRootFilesystem: true
  # runAsNonRoot: true
  # runAsUser: 1000

service:
  type: ClusterIP
  port: 9191
  metricsPort:
    name: http
  annotations: {}
  labels: {}

**extraEnv:
  - name: CB_EXPORTER_DB_USER
    value: customadmin
  - name: CB_EXPORTER_DB_PASSWORD
    value: custompasword
  - db.uri: http://couchbase:8091**

initialDelaySeconds: 5

ingress:
  enabled: false
  annotations: {}
    # kubernetes.io/ingress.class: nginx
    # kubernetes.io/tls-acme: "true"
  hosts:
    - host: chart-example.local
      paths: []
  tls: []
  #  - secretName: chart-example-tls
  #    hosts:
  #      - chart-example.local

resources: {}
  # We usually recommend not to specify default resources and to leave this as a conscious
  # choice for the user. This also increases chances charts run on environments with little
  # resources, such as Minikube. If you do want to specify resources, uncomment the following
  # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
  # limits:
  #   cpu: 100m
  #   memory: 128Mi
  # requests:
  #   cpu: 100m
  #   memory: 128Mi

nodeSelector: {}

tolerations: []

affinity: {}

deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "blakelead-exporter.fullname" . }}
  labels:
    {{- include "blakelead-exporter.labels" . | nindent 4 }}
spec:
  replicas: {{ .Values.replicaCount }}
  selector:
    matchLabels:
      {{- include "blakelead-exporter.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        {{- include "blakelead-exporter.selectorLabels" . | nindent 8 }}
    spec:
    {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
    {{- end }}
      serviceAccountName: {{ include "blakelead-exporter.serviceAccountName" . }}
      securityContext:
        {{- toYaml .Values.podSecurityContext | nindent 8 }}
      containers:
        - name: {{ .Chart.Name }}
          securityContext:
            {{- toYaml .Values.securityContext | nindent 12 }}
          image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          **args:
      {{- range $key, $value := .Values.extraArgs }}
          {{- if $value }}
          - --{{ $key }}={{ $value }}
         {{- else }}
         - --{{ $key }}
         {{- end }}
      {{- end }}**
          ports:
            - name: http
              containerPort: **9191**
              protocol: TCP
          resources:
            {{- toYaml .Values.resources | nindent 12 }}
      {{- with .Values.nodeSelector }}
      nodeSelector:
        {{- toYaml . | nindent 8 }}
      {{- end }}
    {{- with .Values.affinity }}
      affinity:
        {{- toYaml . | nindent 8 }}
    {{- end }}
    {{- with .Values.tolerations }}
      tolerations:
        {{- toYaml . | nindent 8 }}
    {{- end }}

Chart.yaml

apiVersion: v2
name: blakelead-exporter
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: latest

helm install test-blakelead-exporter ./blakelead-exporter

from couchbase_exporter.

blakelead avatar blakelead commented on June 7, 2024

You don't provide env attributes in your deployment.yaml.

You should have something like that (I did not test it):

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "blakelead-exporter.fullname" . }}
  labels:
    {{- include "blakelead-exporter.labels" . | nindent 4 }}
spec:
  replicas: {{ .Values.replicaCount }}
  selector:
    matchLabels:
      {{- include "blakelead-exporter.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        {{- include "blakelead-exporter.selectorLabels" . | nindent 8 }}
    spec:
    {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
    {{- end }}
      serviceAccountName: {{ include "blakelead-exporter.serviceAccountName" . }}
      securityContext:
        {{- toYaml .Values.podSecurityContext | nindent 8 }}
      containers:
        - name: {{ .Chart.Name }}
          securityContext:
            {{- toYaml .Values.securityContext | nindent 12 }}
          image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          env:
      {{- range $key, $value := .Values.extraEnv }}
          {{- if $value }}
          - --{{ $key }}={{ $value }}
         {{- else }}
         - --{{ $key }}
         {{- end }}
      {{- end }}
          args:
      {{- range $key, $value := .Values.extraArgs }}
          {{- if $value }}
          - --{{ $key }}={{ $value }}
         {{- else }}
         - --{{ $key }}
         {{- end }}
      {{- end }}
          ports:
            - name: http
              containerPort: 9191
              protocol: TCP
          resources:
            {{- toYaml .Values.resources | nindent 12 }}
      {{- with .Values.nodeSelector }}
      nodeSelector:
        {{- toYaml . | nindent 8 }}
      {{- end }}
    {{- with .Values.affinity }}
      affinity:
        {{- toYaml . | nindent 8 }}
    {{- end }}
    {{- with .Values.tolerations }}
      tolerations:
        {{- toYaml . | nindent 8 }}
    {{- end }}

from couchbase_exporter.

LilaNKM avatar LilaNKM commented on June 7, 2024

I add

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "blakelead-exporter.fullname" . }}
  labels:
    {{- include "blakelead-exporter.labels" . | nindent 4 }}
spec:
  replicas: {{ .Values.replicaCount }}
  selector:
    matchLabels:
      {{- include "blakelead-exporter.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        {{- include "blakelead-exporter.selectorLabels" . | nindent 8 }}
    spec:
    {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
    {{- end }}
      serviceAccountName: {{ include "blakelead-exporter.serviceAccountName" . }}
      securityContext:
        {{- toYaml .Values.podSecurityContext | nindent 8 }}
      containers:
        - name: {{ .Chart.Name }}
          securityContext:
            {{- toYaml .Values.securityContext | nindent 12 }}
          image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          env:
      {{- range $key, $value := .Values.extraEnvs }}
          {{- if $value }}
          - --{{ $key }}={{ $value }}
         {{- else }}
         - --{{ $key }}
         {{- end }}
      {{- end }}
          args:
      {{- range $key, $value := .Values.extraArgs }}
          {{- if $value }}
          - --{{ $key }}={{ $value }}
         {{- else }}
         - --{{ $key }}
         {{- end }}
      {{- end }}
          ports:
            - name: http
              containerPort: 9191
              protocol: TCP
          resources:
            {{- toYaml .Values.resources | nindent 12 }}
      {{- with .Values.nodeSelector }}
      nodeSelector:
        {{- toYaml . | nindent 8 }}
      {{- end }}
    {{- with .Values.affinity }}
      affinity:
        {{- toYaml . | nindent 8 }}
    {{- end }}
    {{- with .Values.tolerations }}
      tolerations:
        {{- toYaml . | nindent 8 }}
    {{- end }}

And it' still do not take in account extra env values

kubectls logs test-blakelead-exporter-couchbase-7cb79b99bc-6kwsm
time="2020-09-21T15:24:34Z" level=info msg="Couchbase Exporter Version: 0.9.0"
time="2020-09-21T15:24:34Z" level=info msg="config.file="
time="2020-09-21T15:24:34Z" level=info msg="web.listen-address=127.0.0.1:9191"
time="2020-09-21T15:24:34Z" level=info msg="web.telemetry-path=/metrics"
time="2020-09-21T15:24:34Z" level=info msg="web.timeout=10s"
time="2020-09-21T15:24:34Z" level=info msg="db.uri=http://localhost:8091"
time="2020-09-21T15:24:34Z" level=info msg="db.timeout=10s"
time="2020-09-21T15:24:34Z" level=info msg="tls.skip-insecure=false"
time="2020-09-21T15:24:34Z" level=info msg="tls.ca-cert="
time="2020-09-21T15:24:34Z" level=info msg="tls.enabled=false"
time="2020-09-21T15:24:34Z" level=info msg="tls.client-cert="
time="2020-09-21T15:24:34Z" level=info msg="tls.client-key="
time="2020-09-21T15:24:34Z" level=info msg="log.level=info"
time="2020-09-21T15:24:34Z" level=info msg="log.format=text"
time="2020-09-21T15:24:34Z" level=info msg="scrape.cluster=true"
time="2020-09-21T15:24:34Z" level=info msg="scrape.node=true"
time="2020-09-21T15:24:34Z" level=info msg="scrape.bucket=true"
time="2020-09-21T15:24:34Z" level=info msg="scrape.xdcr=true"
time="2020-09-21T15:24:34Z" level=info msg="Cluster exporter registered"
time="2020-09-21T15:24:34Z" level=info msg="Node exporter registered"
time="2020-09-21T15:24:34Z" level=info msg="Bucket exporter registered"
time="2020-09-21T15:24:34Z" level=info msg="Bucketstats exporter registered"
time="2020-09-21T15:24:34Z" level=info msg="XDCR exporter registered"
time="2020-09-21T15:24:34Z" level=info msg="Started listening at 127.0.0.1:9191"

from couchbase_exporter.

blakelead avatar blakelead commented on June 7, 2024

Can it be a typo issue ? extraEnv or extraEnvs ?

from couchbase_exporter.

LilaNKM avatar LilaNKM commented on June 7, 2024

Hello :)
I don't think it's a typo

with value Values.extraEnv it gives the error below:

helm install blakelead-exporter-couchbase ./blakelead-exporter-couchbase --debug --dry-run

Error: unable to build kubernetes objects from release manifest: error validating "": error validating data: [ValidationError(Deployment.spec.template.spec.containers[0].env[0]): invalid type for io.k8s.api.core.v1.EnvVar: got "string", expected "map", ValidationError(Deployment.spec.template.spec.containers[0].env[1]): invalid type for io.k8s.api.core.v1.EnvVar: got "string", expected "map", ValidationError(Deployment.spec.template.spec.containers[0].env[2]): invalid type for io.k8s.api.core.v1.EnvVar: got "string", expected "map"]
helm.go:76: [debug] error validating "": error validating data: [ValidationError(Deployment.spec.template.spec.containers[0].env[0]): invalid type for io.k8s.api.core.v1.EnvVar: got "string", expected "map", ValidationError(Deployment.spec.template.spec.containers[0].env[1]): invalid type for io.k8s.api.core.v1.EnvVar: got "string", expected "map", ValidationError(Deployment.spec.template.spec.containers[0].env[2]): invalid type for io.k8s.api.core.v1.EnvVar: got "string", expected "map"]

from couchbase_exporter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.