-
-
Save tksm/2de340ba5b057ce8f099f8541c8cb400 to your computer and use it in GitHub Desktop.
Confirmation manifests for Prometheus Ingress discovery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: networking.k8s.io/v1 | |
kind: Ingress | |
metadata: | |
name: test-ingress | |
spec: | |
tls: | |
- hosts: | |
- example.com | |
rules: | |
- host: "example.com" | |
http: | |
paths: | |
- pathType: Prefix | |
path: "/mypath" | |
backend: | |
service: | |
name: mysvc | |
port: | |
number: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: networking.k8s.io/v1beta1 | |
kind: Ingress | |
metadata: | |
name: test-ingress | |
spec: | |
tls: | |
- hosts: | |
- example.com | |
rules: | |
- host: "example.com" | |
http: | |
paths: | |
- backend: | |
serviceName: mysvc | |
servicePort: 80 | |
path: "/mypath" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: rbac.authorization.k8s.io/v1 | |
kind: ClusterRole | |
metadata: | |
name: prometheus | |
rules: | |
- apiGroups: [""] | |
resources: | |
- nodes | |
- nodes/metrics | |
- services | |
- endpoints | |
- pods | |
verbs: ["get", "list", "watch"] | |
- apiGroups: | |
- extensions | |
- networking.k8s.io | |
resources: | |
- ingresses | |
verbs: ["get", "list", "watch"] | |
- nonResourceURLs: ["/metrics", "/metrics/cadvisor"] | |
verbs: ["get"] | |
--- | |
apiVersion: v1 | |
kind: ServiceAccount | |
metadata: | |
name: prometheus | |
namespace: default | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1 | |
kind: ClusterRoleBinding | |
metadata: | |
name: prometheus | |
roleRef: | |
apiGroup: rbac.authorization.k8s.io | |
kind: ClusterRole | |
name: prometheus | |
subjects: | |
- kind: ServiceAccount | |
name: prometheus | |
namespace: default | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: prometheus | |
namespace: default | |
spec: | |
selector: | |
app: prometheus | |
ports: | |
- port: 9090 | |
targetPort: 9090 | |
--- | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: prometheus | |
namespace: default | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: prometheus | |
template: | |
metadata: | |
labels: | |
app: prometheus | |
spec: | |
serviceAccountName: prometheus | |
dnsPolicy: ClusterFirst | |
containers: | |
- name: prometheus | |
image: prom/prometheus-linux-amd64:k8s-networking-v1 | |
imagePullPolicy: IfNotPresent | |
volumeMounts: | |
- name: config-volume | |
mountPath: /etc/prometheus/config | |
args: | |
- --config.file=/etc/prometheus/config/prometheus.yml | |
volumes: | |
- name: config-volume | |
configMap: | |
name: prometheus-config | |
--- | |
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: prometheus-config | |
namespace: default | |
labels: | |
app: prometheus | |
data: | |
prometheus.yml: | | |
scrape_configs: | |
- job_name: "kubernetes-ingresses" | |
metrics_path: /metrics | |
kubernetes_sd_configs: | |
- role: ingress | |
relabel_configs: | |
# dummy scrape target | |
- target_label: __address__ | |
replacement: localhost:9090 | |
# just check ingress labels | |
- action: labelmap | |
regex: __meta_kubernetes_ingress_label_(.+) | |
- source_labels: [__meta_kubernetes_namespace] | |
target_label: kubernetes_namespace | |
- source_labels: [__meta_kubernetes_ingress_name] | |
target_label: kubernetes_name | |
- source_labels: [__meta_kubernetes_ingress_scheme] | |
target_label: kubernetes_ingress_scheme | |
- source_labels: [__meta_kubernetes_ingress_path] | |
target_label: kubernetes_ingress_path | |
- source_labels: [__meta_kubernetes_ingress_host] | |
target_label: kubernetes_ingress_host |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment