Merge pull request #39664 from Zhuzhenghao/run-single-instance-stateful-application.md

[zh] sync run-single-instance-stateful-application and horizontal-pod-autoscale
pull/39663/head^2
Kubernetes Prow Robot 2023-02-25 22:20:17 -08:00 committed by GitHub
commit f6d41d2959
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 62 additions and 55 deletions

View File

@ -274,7 +274,7 @@ with missing metrics will be used to adjust the final scaling amount.
<!--
When scaling on CPU, if any pod has yet to become ready (it's still
initializing, or possibly is unhealthy) *or* the most recent metric point for
initializing, or possibly is unhealthy) _or_ the most recent metric point for
the pod was before it became ready, that pod is set aside as well.
-->
当使用 CPU 指标来扩缩时,任何还未就绪(还在初始化,或者可能是不健康的)状态的 Pod **或**
@ -335,7 +335,7 @@ number of Pods.
在其他情况下,新比率用于决定对 Pod 数量的任何更改。
<!--
Note that the *original* value for the average utilization is reported
Note that the _original_ value for the average utilization is reported
back via the HorizontalPodAutoscaler status, without factoring in the
not-yet-ready pods or missing metrics, even when the new usage ratio is
used.
@ -405,8 +405,8 @@ More details about the API object can be found at
When managing the scale of a group of replicas using the HorizontalPodAutoscaler,
it is possible that the number of replicas keeps fluctuating frequently due to the
dynamic nature of the metrics evaluated. This is sometimes referred to as *thrashing*,
or *flapping*. It's similar to the concept of *hysteresis* in cybernetics.
dynamic nature of the metrics evaluated. This is sometimes referred to as _thrashing_,
or _flapping_. It's similar to the concept of _hysteresis_ in cybernetics.
-->
## 工作量规模的稳定性 {#flapping}
@ -918,6 +918,7 @@ behavior:
scaleDown:
selectPolicy: Disabled
```
<!--
## Support for HorizontalPodAutoscaler in kubectl
@ -936,7 +937,7 @@ Finally, you can delete an autoscaler using `kubectl delete hpa`.
<!--
In addition, there is a special `kubectl autoscale` command for creating a HorizontalPodAutoscaler object.
For instance, executing `kubectl autoscale rs foo --min=2 --max=5 --cpu-percent=80`
will create an autoscaler for ReplicaSet *foo*, with target CPU utilization set to `80%`
will create an autoscaler for ReplicaSet _foo_, with target CPU utilization set to `80%`
and the number of replicas between 2 and 5.
-->
此外,还有一个特殊的 `kubectl autoscale` 命令用于创建 HorizontalPodAutoscaler 对象。
@ -1053,4 +1054,3 @@ For more information on HorizontalPodAutoscaler:
* 如果你想编写自己的自定义指标适配器,
请查看 [boilerplate](https://github.com/kubernetes-sigs/custom-metrics-apiserver) 以开始使用。
* 阅读 [API 参考](/zh-cn/docs/reference/kubernetes-api/workload-resources/horizontal-pod-autoscaler-v2/)。

View File

@ -60,22 +60,28 @@ for a secure solution.
{{< codenew file="application/mysql/mysql-deployment.yaml" >}}
{{< codenew file="application/mysql/mysql-pv.yaml" >}}
1. <!--Deploy the PV and PVC of the YAML file-->
部署 YAML 文件中定义的 PV 和 PVC
<!--
1. Deploy the PV and PVC of the YAML file:
-->
1. 部署 YAML 文件中定义的 PV 和 PVC
```shell
kubectl apply -f https://k8s.io/examples/application/mysql/mysql-pv.yaml
```
1. <!-- Deploy the contents of the YAML file -->
部署 YAML 文件中定义的 Deployment
<!--
1. Deploy the contents of the YAML file:
-->
2. 部署 YAML 文件中定义的 Deployment
```shell
kubectl apply -f https://k8s.io/examples/application/mysql/mysql-deployment.yaml
```
1. <!-- Display information about the Deployment -->
展示 Deployment 相关信息:
<!--
1. Display information about the Deployment:
-->
3. 展示 Deployment 相关信息:
```shell
kubectl describe deployment mysql
@ -124,8 +130,10 @@ for a secure solution.
33s 33s 1 {deployment-controller } Normal ScalingReplicaSet Scaled up replica set mysql-63082529 to 1
```
1. <!-- List the pods created by the Deployment -->
列举出 Deployment 创建的 pods:
<!--
1. List the pods created by the Deployment:
-->
4. 列举出 Deployment 创建的 pods:
```shell
kubectl get pods -l app=mysql
@ -141,8 +149,10 @@ for a secure solution.
mysql-63082529-2z3ki 1/1 Running 0 3m
```
1. <!-- Inspect the PersistentVolumeClaim -->
查看 PersistentVolumeClaim
<!--
1. Inspect the PersistentVolumeClaim:
-->
5. 查看 PersistentVolumeClaim
```shell
kubectl describe pvc mysql-pv-claim
@ -180,14 +190,13 @@ Run a MySQL client to connect to the server:
-->
## 访问 MySQL 实例 {#accessing-the-mysql-instance}
前面 YAML 文件中创建了一个允许集群内其他 Pod 访问的数据库服务。该服务中选项
`clusterIP: None` 让服务 DNS 名称直接解析为 Pod 的 IP 地址。
当在一个服务下只有一个 Pod 并且不打算增加 Pod 的数量这是最好的.
运行 MySQL 客户端以连接到服务器:
```
```shell
kubectl run -it --rm --image=mysql:5.6 --restart=Never mysql-client -- mysql -h mysql -ppassword
```
@ -246,7 +255,7 @@ Delete the deployed objects by name:
通过名称删除部署的对象:
```
```shell
kubectl delete deployment,svc mysql
kubectl delete pvc mysql-pv-claim
kubectl delete pv mysql-pv-volume
@ -282,5 +291,3 @@ PersistentVolume 将被自动删除。
* 参阅 [kubectl run 文档](/docs/reference/generated/kubectl/kubectl-commands/#run)
* 参阅[卷](/zh-cn/docs/concepts/storage/volumes/)和[持久卷](/zh-cn/docs/concepts/storage/persistent-volumes/)