Files
KubePi/docs/resources/horizontalpodautoscaler.yaml
wanghe-fit2cloud 9c22897034 NaN
2021-09-06 18:41:56 +08:00

86 lines
1.6 KiB
YAML

apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: kuard-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: kuard-deployment
minReplicas: 2
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 80
- type: Pods
pods:
metric:
name: packets-per-second
target:
type: AverageValue
averageValue: 1k
- type: Resource
resource:
name: memory
target:
type: Utilization
averageValue: 200Mi
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: kubelet-api-admin
subjects:
- kind: User
name: kubelet-api
apiGroup: rbac.authorization.k8s.io
roleRef:
kind: ClusterRole
name: system:kubelet-api-admin
apiGroup: rbac.authorization.k8s.io
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: kuard-deployment
labels:
app: kuard
spec:
replicas: 3
selector:
matchLabels:
app: kuard
template:
metadata:
labels:
app: kuard
spec:
containers:
- image: gcr.io/kuar-demo/kuard-amd64:1
name: kuard
ports:
- containerPort: 8080
name: http
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"
---
apiVersion: v1
kind: Service
metadata:
name: kuard-service
spec:
selector:
app: kuard
ports:
- port: 80
targetPort: 8080