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

View File

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

View File

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