新增说明及示例文件

This commit is contained in:
2023-12-15 16:39:01 +08:00
committed by huty
parent 823b19c3f0
commit 3445c145aa
71 changed files with 4048 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
# HorizontalPodAutoscalerPod 水平自动扩缩说明官方文档https://v1-22.docs.kubernetes.io/zh/docs/tasks/run-application/horizontal-pod-autoscale
# API 版本
apiVersion: autoscaling/v2
# 资源类型
kind: HorizontalPodAutoscaler
# 元数据
metadata:
## 名称
name: 此 HorizontalPodAutoscaler 的名称
## 命名空间
namespace: 此 HorizontalPodAutoscaler 所属的命名空间
# 数据
spec:
## 扩缩目标
scaleTargetRef:
### 扩缩目标的 API 版本
apiVersion: apps/v1
### 扩缩目标的资源类型
kind: Deployment
### 扩缩目标的资源名称
name: php-apache
## 最小副本数
minReplicas: 1
## 最大副本数
maxReplicas: 10
## 指标
metrics:
### 指标1
#### 指标类型【Resource资源如 CPU、内存等PodsKubernetes PodsObject对象】
- type: Resource
#### 指标详情
resource:
##### 指标名称
name: cpu
##### 指标
target:
###### 类型 【Utilization百分比AverageValue绝对值】
type: Utilization
###### 数值(百分比)【仅当 type 为 Utilization 时生效】
averageUtilization: 50
###### 数值(绝对值)【仅当 type 为 AverageValue 时生效】
averageValue: 0

View File

@@ -0,0 +1,19 @@
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: hpa-example
namespace: demo
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: php-apache
minReplicas: 1
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50