change HPA setting for kubernetes 1.8

pull/88/head
Jimmy Song 2017-12-13 23:01:57 +08:00
parent 089eb02632
commit 1894043ef3
4 changed files with 66 additions and 32 deletions

View File

@ -0,0 +1,18 @@
kind: HorizontalPodAutoscaler
apiVersion: autoscaling/v2beta1
metadata:
name: sample-metrics-app-hpa
spec:
scaleTargetRef:
kind: Deployment
name: sample-metrics-app
minReplicas: 2
maxReplicas: 10
metrics:
- type: Object
object:
target:
kind: Service
name: sample-metrics-app
metricName: http_requests
targetValue: 100

View File

@ -1,4 +1,17 @@
apiVersion: rbac.authorization.k8s.io/v1beta1 apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: prometheus-operator
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: prometheus-operator
subjects:
- kind: ServiceAccount
name: prometheus-operator
namespace: default
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole kind: ClusterRole
metadata: metadata:
name: prometheus-operator name: prometheus-operator
@ -8,7 +21,13 @@ rules:
resources: resources:
- thirdpartyresources - thirdpartyresources
verbs: verbs:
- create - "*"
- apiGroups:
- apiextensions.k8s.io
resources:
- customresourcedefinitions
verbs:
- "*"
- apiGroups: - apiGroups:
- monitoring.coreos.com - monitoring.coreos.com
resources: resources:
@ -40,46 +59,43 @@ rules:
resources: resources:
- nodes - nodes
verbs: ["list", "watch"] verbs: ["list", "watch"]
- apiGroups: [""]
resources:
- namespaces
verbs: ["list"]
--- ---
apiVersion: v1 apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: prometheus-operator name: prometheus-operator
--- ---
apiVersion: rbac.authorization.k8s.io/v1beta1 apiVersion: extensions/v1beta1
kind: ClusterRoleBinding
metadata:
name: prometheus-operator
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: prometheus-operator
subjects:
- kind: ServiceAccount
name: prometheus-operator
namespace: default
---
apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: prometheus-operator
labels: labels:
operator: prometheus k8s-app: prometheus-operator
name: prometheus-operator
spec: spec:
replicas: 1 replicas: 1
template: template:
metadata: metadata:
labels: labels:
operator: prometheus k8s-app: prometheus-operator
spec: spec:
serviceAccountName: prometheus-operator
containers: containers:
- name: prometheus-operator - args:
image: sz-pg-oam-docker-hub-001.tendcloud.com/library/prometheus-operator:v0.10.1 - --kubelet-service=kube-system/kubelet
resources: - --config-reloader-image=sz-pg-oam-docker-hub-001.tendcloud.com/library/configmap-reload:v0.0.1
requests: image: sz-pg-oam-docker-hub-001.tendcloud.com/library/prometheus-operator:v0.15.0
cpu: 100m name: prometheus-operator
memory: 50Mi ports:
limits: - containerPort: 8080
cpu: 200m name: http
memory: 100Mi resources:
limits:
cpu: 200m
memory: 100Mi
requests:
cpu: 100m
memory: 50Mi
serviceAccountName: prometheus-operator

View File

@ -44,7 +44,7 @@ spec:
selector: selector:
app: sample-metrics-app app: sample-metrics-app
--- ---
apiVersion: monitoring.coreos.com/v1alpha1 apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor kind: ServiceMonitor
metadata: metadata:
name: sample-metrics-app name: sample-metrics-app
@ -58,7 +58,7 @@ spec:
- port: web - port: web
--- ---
kind: HorizontalPodAutoscaler kind: HorizontalPodAutoscaler
apiVersion: autoscaling/v2alpha1 apiVersion: autoscaling/v2beta1
metadata: metadata:
name: sample-metrics-app-hpa name: sample-metrics-app-hpa
spec: spec:

View File

@ -33,7 +33,7 @@ subjects:
name: prometheus name: prometheus
namespace: default namespace: default
--- ---
apiVersion: monitoring.coreos.com/v1alpha1 apiVersion: monitoring.coreos.com/v1
kind: Prometheus kind: Prometheus
metadata: metadata:
name: sample-metrics-prom name: sample-metrics-prom
@ -42,7 +42,7 @@ metadata:
prometheus: sample-metrics-prom prometheus: sample-metrics-prom
spec: spec:
replicas: 1 replicas: 1
baseImage: prom/prometheus baseImage: sz-pg-oam-docker-hub-001.tendcloud.com/library/prometheus
version: v1.7.1 version: v1.7.1
serviceAccountName: prometheus serviceAccountName: prometheus
serviceMonitorSelector: serviceMonitorSelector: