Merge branch 'master' into restrict-service-monitor

This commit is contained in:
Frederic Branczyk
2018-03-20 08:47:43 -04:00
committed by GitHub
11 changed files with 35 additions and 29 deletions

View File

@@ -1,18 +1,3 @@
#!/usr/bin/env bash
if [ -z "${KUBECONFIG}" ]; then
KUBECONFIG=~/.kube/config
fi
if [ -z "${NAMESPACE}" ]; then
NAMESPACE=default
fi
kubectl --namespace "$NAMESPACE" --kubeconfig="$KUBECONFIG" apply -f manifests/examples/example-app/prometheus-frontend-service-account.yaml
kubectl --namespace "$NAMESPACE" --kubeconfig="$KUBECONFIG" apply -f manifests/examples/example-app/prometheus-frontend-role.yaml
kubectl --namespace "$NAMESPACE" --kubeconfig="$KUBECONFIG" apply -f manifests/examples/example-app/prometheus-frontend-role-binding.yaml
kubectl --namespace "$NAMESPACE" --kubeconfig="$KUBECONFIG" apply -f manifests/examples/example-app/prometheus-frontend-svc.yaml
kubectl --namespace "$NAMESPACE" --kubeconfig="$KUBECONFIG" apply -f manifests/examples/example-app/example-app.yaml
kubectl --namespace "$NAMESPACE" --kubeconfig="$KUBECONFIG" apply -f manifests/examples/example-app/prometheus-frontend.yaml
kubectl --namespace "$NAMESPACE" --kubeconfig="$KUBECONFIG" apply -f manifests/examples/example-app/servicemonitor-frontend.yaml
kubectl apply -f manifests/examples/example-app

View File

@@ -1,12 +1,3 @@
#!/usr/bin/env bash
if [ -z "${KUBECONFIG}" ]; then
KUBECONFIG=~/.kube/config
fi
if [ -z "${NAMESPACE}" ]; then
NAMESPACE=default
fi
kubectl --namespace "$NAMESPACE" --kubeconfig="$KUBECONFIG" delete -f manifests/examples/example-app
kubectl delete -f manifests/examples/example-app

View File

@@ -6,7 +6,7 @@ kind: ConfigMap
metadata:
name: prometheus-k8s-rules
labels:
role: prometheus-rulefiles
role: alert-rules
prometheus: k8s
data:
EOF

View File

@@ -4,6 +4,7 @@ metadata:
name: example-app
labels:
tier: frontend
namespace: default
spec:
selector:
app: example-app
@@ -17,6 +18,7 @@ apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: example-app
namespace: default
spec:
replicas: 4
template:

View File

@@ -0,0 +1,13 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
name: prometheus-frontend
namespace: monitoring
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: alertmanager-discovery
subjects:
- kind: ServiceAccount
name: prometheus-frontend
namespace: default

View File

@@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: Role
metadata:
name: alertmanager-discovery
namespace: monitoring
rules:
- apiGroups: [""]
resources:
- services
- endpoints
- pods
verbs: ["list", "watch"]

View File

@@ -2,3 +2,4 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: prometheus-frontend
namespace: default

View File

@@ -2,6 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: prometheus-frontend
namespace: default
spec:
type: NodePort
ports:

View File

@@ -2,6 +2,7 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: frontend
namespace: default
labels:
tier: frontend
spec:

View File

@@ -3,7 +3,7 @@ kind: ConfigMap
metadata:
name: prometheus-k8s-rules
labels:
role: prometheus-rulefiles
role: alert-rules
prometheus: k8s
data:
alertmanager.rules.yaml: |+

View File

@@ -13,7 +13,7 @@ spec:
- {key: k8s-app, operator: Exists}
ruleSelector:
matchLabels:
role: prometheus-rulefiles
role: alert-rules
prometheus: k8s
resources:
requests: