--- apiVersion:v1 kind:Service metadata: name:pg-prometheus namespace:default labels: app:pg-prometheus spec: type:NodePort ports: -port:5432 targetPort:5432 protocol:TCP name:"postgresql" # label keys and values that must match in order to receive traffic for this service selector: app:pg-prometheus
apiVersion:apps/v1# for versions before 1.9.0 use apps/v1beta2 kind:StatefulSet metadata: name:pg-prometheus-adapter namespace:default spec: serviceName:"pg-prometheus-adapter" selector: matchLabels: app:pg-prometheus-adapter replicas:1# tells deployment to run 2 pods matching the template template: metadata: labels: app:pg-prometheus-adapter spec: containers: -name:pg-prometheus-adapter image:registry.c2cloud.cn/library/prometheus-postgresql-adapter:0.4.1 ports: -containerPort:9201 args: -"-pg.host=pg-prometheus" -"-pg.password=888888" -"-pg.prometheus-log-samples"
--- apiVersion:v1 kind:Service metadata: name:pg-prometheus-adapter namespace:default labels: app:pg-prometheus-adapter spec: type:NodePort ports: -port:9201 targetPort:9201 protocol:TCP name:"prometheus-adapter" # label keys and values that must match in order to receive traffic for this service selector: app:pg-prometheus-adapter