mirror of
https://github.com/rancher/rancher-docs.git
synced 2026-09-24 20:18:18 +00:00
Sync translation with English docs
This commit is contained in:
+1
@@ -68,4 +68,5 @@ Longhorn 为每个卷创建专用的存储控制器,并在存储在多个节
|
||||
有关其架构的更多信息,请参阅[此处](https://longhorn.io/docs/latest/concepts/)。
|
||||
|
||||
<figcaption>Longhorn 架构</figcaption>
|
||||
|
||||

|
||||
|
||||
+3
@@ -55,6 +55,7 @@ Alertmanager UI 可让你查看最近触发的告警。
|
||||
有关在 Rancher 中配置 Alertmanager 的更多信息,请参阅[此页面](../../../how-to-guides/advanced-user-guides/monitoring-v2-configuration-guides/advanced-configuration/alertmanager.md)。
|
||||
|
||||
<figcaption>Alertmanager UI</figcaption>
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -91,6 +92,7 @@ Alertmanager UI 可让你查看最近触发的告警。
|
||||
1. 单击 **Prometheus 目标**。
|
||||
|
||||
<figcaption>Prometheus UI 中的目标</figcaption>
|
||||
|
||||

|
||||
|
||||
### 查看 PrometheusRules
|
||||
@@ -107,6 +109,7 @@ Alertmanager UI 可让你查看最近触发的告警。
|
||||
你还可以在 Prometheus UI 中查看规则:
|
||||
|
||||
<figcaption>Prometheus UI 中的规则</figcaption>
|
||||
|
||||

|
||||
|
||||
有关在 Rancher 中配置 PrometheusRule 的更多信息,请参阅[此页面](../../../how-to-guides/advanced-user-guides/monitoring-v2-configuration-guides/advanced-configuration/prometheusrules.md)。
|
||||
+46
-46
@@ -12,49 +12,49 @@ weight: 6
|
||||
|
||||
### 集群 CPU 利用率
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | `1 - (avg(irate(node_cpu_seconds_total{mode="idle"}[5m])) by (instance))` |
|
||||
| 摘要 | `1 - (avg(irate(node_cpu_seconds_total{mode="idle"}[5m])))` |
|
||||
|
||||
### 集群平均负载
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | <table><tr><td>load1</td><td>`sum(node_load1) by (instance) / count(node_cpu_seconds_total{mode="system"}) by (instance)`</td></tr><tr><td>load5</td><td>`sum(node_load5) by (instance) / count(node_cpu_seconds_total{mode="system"}) by (instance)`</td></tr><tr><td>load15</td><td>`sum(node_load15) by (instance) / count(node_cpu_seconds_total{mode="system"}) by (instance)`</td></tr></table> |
|
||||
| 摘要 | <table><tr><td>load1</td><td>`sum(node_load1) by (instance) / count(node_cpu_seconds_total{mode="system"})`</td></tr><tr><td>load5</td><td>`sum(node_load5) by (instance) / count(node_cpu_seconds_total{mode="system"})`</td></tr><tr><td>load15</td><td>`sum(node_load15) by (instance) / count(node_cpu_seconds_total{mode="system"})`</td></tr></table> |
|
||||
|
||||
### 集群内存利用率
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | `1 - sum(node_memory_MemAvailable_bytes) by (instance) / sum(node_memory_MemTotal_bytes) by (instance)` |
|
||||
| 摘要 | `1 - sum(node_memory_MemAvailable_bytes) / sum(node_memory_MemTotal_bytes)` |
|
||||
|
||||
### 集群磁盘利用率
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | `(sum(node_filesystem_size_bytes{device!="rootfs"}) by (instance) - sum(node_filesystem_free_bytes{device!="rootfs"}) by (instance)) / sum(node_filesystem_size_bytes{device!="rootfs"}) by (instance)` |
|
||||
| 摘要 | `(sum(node_filesystem_size_bytes{device!="rootfs"}) - sum(node_filesystem_free_bytes{device!="rootfs"})) / sum(node_filesystem_size_bytes{device!="rootfs"})` |
|
||||
|
||||
### 集群磁盘 I/O
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | <table><tr><td>read</td><td>`sum(rate(node_disk_read_bytes_total[5m])) by (instance)`</td></tr><tr><td>written</td><td>`sum(rate(node_disk_written_bytes_total[5m])) by (instance)`</td></tr></table> |
|
||||
| 摘要 | <table><tr><td>read</td><td>`sum(rate(node_disk_read_bytes_total[5m]))`</td></tr><tr><td>written</td><td>`sum(rate(node_disk_written_bytes_total[5m]))`</td></tr></table> |
|
||||
|
||||
### 集群网络数据包
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | <table><tr><td>receive-dropped</td><td><code>sum(rate(node_network_receive_drop_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*"}[5m])) by (instance)</code></td></tr><tr><td>receive-errs</td><td><code>sum(rate(node_network_receive_errs_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*"}[5m])) by (instance)</code></td></tr><tr><td>receive-packets</td><td><code>sum(rate(node_network_receive_packets_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*"}[5m])) by (instance)</code></td></tr><tr><td>transmit-dropped</td><td><code>sum(rate(node_network_transmit_drop_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*"}[5m])) by (instance)</code></td></tr><tr><td>transmit-errs</td><td><code>sum(rate(node_network_transmit_errs_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*"}[5m])) by (instance)</code></td></tr><tr><td>transmit-packets</td><td><code>sum(rate(node_network_transmit_packets_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*"}[5m])) by (instance)</code></td></tr></table> |
|
||||
| 摘要 | <table><tr><td>receive-dropped</td><td><code>sum(rate(node_network_receive_drop_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*"}[5m]))</code></td></tr><tr><td>receive-errs</td><td><code>sum(rate(node_network_receive_errs_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*"}[5m]))</code></td></tr><tr><td>receive-packets</td><td><code>sum(rate(node_network_receive_packets_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*"}[5m]))</code></td></tr><tr><td>transmit-dropped</td><td><code>sum(rate(node_network_transmit_drop_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*"}[5m]))</code></td></tr><tr><td>transmit-errs</td><td><code>sum(rate(node_network_transmit_errs_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*"}[5m]))</code></td></tr><tr><td>transmit-packets</td><td><code>sum(rate(node_network_transmit_packets_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*"}[5m]))</code></td></tr></table> |
|
||||
|
||||
### 集群网络 I/O
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | <table><tr><td>receive</td><td><code>sum(rate(node_network_receive_bytes_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*"}[5m])) by (instance)</code></td></tr><tr><td>transmit</td><td><code>sum(rate(node_network_transmit_bytes_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*"}[5m])) by (instance)</code></td></tr></table> |
|
||||
| 摘要 | <table><tr><td>receive</td><td><code>sum(rate(node_network_receive_bytes_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*"}[5m]))</code></td></tr><tr><td>transmit</td><td><code>sum(rate(node_network_transmit_bytes_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*"}[5m]))</code></td></tr></table> |
|
||||
@@ -63,49 +63,49 @@ weight: 6
|
||||
|
||||
### 节点 CPU 利用率
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | `avg(irate(node_cpu_seconds_total{mode!="idle", instance=~"$instance"}[5m])) by (mode)` |
|
||||
| 摘要 | `1 - (avg(irate(node_cpu_seconds_total{mode="idle", instance=~"$instance"}[5m])))` |
|
||||
|
||||
### 节点平均负载
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | <table><tr><td>load1</td><td>`sum(node_load1{instance=~"$instance"}) / count(node_cpu_seconds_total{mode="system",instance=~"$instance"})`</td></tr><tr><td>load5</td><td>`sum(node_load5{instance=~"$instance"}) / count(node_cpu_seconds_total{mode="system",instance=~"$instance"})`</td></tr><tr><td>load15</td><td>`sum(node_load15{instance=~"$instance"}) / count(node_cpu_seconds_total{mode="system",instance=~"$instance"})`</td></tr></table> |
|
||||
| 摘要 | <table><tr><td>load1</td><td>`sum(node_load1{instance=~"$instance"}) / count(node_cpu_seconds_total{mode="system",instance=~"$instance"})`</td></tr><tr><td>load5</td><td>`sum(node_load5{instance=~"$instance"}) / count(node_cpu_seconds_total{mode="system",instance=~"$instance"})`</td></tr><tr><td>load15</td><td>`sum(node_load15{instance=~"$instance"}) / count(node_cpu_seconds_total{mode="system",instance=~"$instance"})`</td></tr></table> |
|
||||
|
||||
### 节点内存利用率
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | `1 - sum(node_memory_MemAvailable_bytes{instance=~"$instance"}) / sum(node_memory_MemTotal_bytes{instance=~"$instance"})` |
|
||||
| 摘要 | `1 - sum(node_memory_MemAvailable_bytes{instance=~"$instance"}) / sum(node_memory_MemTotal_bytes{instance=~"$instance"}) ` |
|
||||
|
||||
### 节点磁盘利用率
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | `(sum(node_filesystem_size_bytes{device!="rootfs",instance=~"$instance"}) by (device) - sum(node_filesystem_free_bytes{device!="rootfs",instance=~"$instance"}) by (device)) / sum(node_filesystem_size_bytes{device!="rootfs",instance=~"$instance"}) by (device)` |
|
||||
| 摘要 | `(sum(node_filesystem_size_bytes{device!="rootfs",instance=~"$instance"}) - sum(node_filesystem_free_bytes{device!="rootfs",instance=~"$instance"})) / sum(node_filesystem_size_bytes{device!="rootfs",instance=~"$instance"})` |
|
||||
|
||||
### 节点磁盘 I/O
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | <table><tr><td>read</td><td>`sum(rate(node_disk_read_bytes_total{instance=~"$instance"}[5m]))`</td></tr><tr><td>written</td><td>`sum(rate(node_disk_written_bytes_total{instance=~"$instance"}[5m]))`</td></tr></table> |
|
||||
| 摘要 | <table><tr><td>read</td><td>`sum(rate(node_disk_read_bytes_total{instance=~"$instance"}[5m]))`</td></tr><tr><td>written</td><td>`sum(rate(node_disk_written_bytes_total{instance=~"$instance"}[5m]))`</td></tr></table> |
|
||||
|
||||
### 节点网络数据包
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | <table><tr><td>receive-dropped</td><td><code>sum(rate(node_network_receive_drop_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*",instance=~"$instance"}[5m])) by (device)</code></td></tr><tr><td>receive-errs</td><td><code>sum(rate(node_network_receive_errs_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*",instance=~"$instance"}[5m])) by (device)</code></td></tr><tr><td>receive-packets</td><td><code>sum(rate(node_network_receive_packets_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*",instance=~"$instance"}[5m])) by (device)</code></td></tr><tr><td>transmit-dropped</td><td><code>sum(rate(node_network_transmit_drop_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*",instance=~"$instance"}[5m])) by (device)</code></td></tr><tr><td>transmit-errs</td><td><code>sum(rate(node_network_transmit_errs_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*",instance=~"$instance"}[5m])) by (device)</code></td></tr><tr><td>transmit-packets</td><td><code>sum(rate(node_network_transmit_packets_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*",instance=~"$instance"}[5m])) by (device)</code></td></tr></table> |
|
||||
| 摘要 | <table><tr><td>receive-dropped</td><td><code>sum(rate(node_network_receive_drop_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*",instance=~"$instance"}[5m]))</code></td></tr><tr><td>receive-errs</td><td><code>sum(rate(node_network_receive_errs_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*",instance=~"$instance"}[5m]))</code></td></tr><tr><td>receive-packets</td><td><code>sum(rate(node_network_receive_packets_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*",instance=~"$instance"}[5m]))</code></td></tr><tr><td>transmit-dropped</td><td><code>sum(rate(node_network_transmit_drop_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*",instance=~"$instance"}[5m]))</code></td></tr><tr><td>transmit-errs</td><td><code>sum(rate(node_network_transmit_errs_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*",instance=~"$instance"}[5m]))</code></td></tr><tr><td>transmit-packets</td><td><code>sum(rate(node_network_transmit_packets_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*",instance=~"$instance"}[5m]))</code></td></tr></table> |
|
||||
|
||||
### 节点网络 I/O
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | <table><tr><td>receive</td><td><code>sum(rate(node_network_receive_bytes_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*",instance=~"$instance"}[5m])) by (device)</code></td></tr><tr><td>transmit</td><td><code>sum(rate(node_network_transmit_bytes_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*",instance=~"$instance"}[5m])) by (device)</code></td></tr></table> |
|
||||
| 摘要 | <table><tr><td>receive</td><td><code>sum(rate(node_network_receive_bytes_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*",instance=~"$instance"}[5m]))</code></td></tr><tr><td>transmit</td><td><code>sum(rate(node_network_transmit_bytes_total{device!~"lo | veth.* | docker.* | flannel.* | cali.* | cbr.*",instance=~"$instance"}[5m]))</code></td></tr></table> |
|
||||
@@ -126,56 +126,56 @@ weight: 6
|
||||
|
||||
### GRPC 客户端流量
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | <table><tr><td>in</td><td>`sum(rate(etcd_network_client_grpc_received_bytes_total[5m])) by (instance)`</td></tr><tr><td>out</td><td>`sum(rate(etcd_network_client_grpc_sent_bytes_total[5m])) by (instance)`</td></tr></table> |
|
||||
| 摘要 | <table><tr><td>in</td><td>`sum(rate(etcd_network_client_grpc_received_bytes_total[5m]))`</td></tr><tr><td>out</td><td>`sum(rate(etcd_network_client_grpc_sent_bytes_total[5m]))`</td></tr></table> |
|
||||
|
||||
### 对等流量
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | <table><tr><td>in</td><td>`sum(rate(etcd_network_peer_received_bytes_total[5m])) by (instance)`</td></tr><tr><td>out</td><td>`sum(rate(etcd_network_peer_sent_bytes_total[5m])) by (instance)`</td></tr></table> |
|
||||
| 摘要 | <table><tr><td>in</td><td>`sum(rate(etcd_network_peer_received_bytes_total[5m]))`</td></tr><tr><td>out</td><td>`sum(rate(etcd_network_peer_sent_bytes_total[5m]))`</td></tr></table> |
|
||||
|
||||
### 数据库大小
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | `sum(etcd_debugging_mvcc_db_total_size_in_bytes) by (instance)` |
|
||||
| 摘要 | `sum(etcd_debugging_mvcc_db_total_size_in_bytes)` |
|
||||
|
||||
### 活动流
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | <table><tr><td>lease-watch</td><td>`sum(grpc_server_started_total{grpc_service="etcdserverpb.Lease",grpc_type="bidi_stream"}) by (instance) - sum(grpc_server_handled_total{grpc_service="etcdserverpb.Lease",grpc_type="bidi_stream"}) by (instance)`</td></tr><tr><td>watch</td><td>`sum(grpc_server_started_total{grpc_service="etcdserverpb.Watch",grpc_type="bidi_stream"}) by (instance) - sum(grpc_server_handled_total{grpc_service="etcdserverpb.Watch",grpc_type="bidi_stream"}) by (instance)`</td></tr></table> |
|
||||
| 摘要 | <table><tr><td>lease-watch</td><td>`sum(grpc_server_started_total{grpc_service="etcdserverpb.Lease",grpc_type="bidi_stream"}) - sum(grpc_server_handled_total{grpc_service="etcdserverpb.Lease",grpc_type="bidi_stream"})`</td></tr><tr><td>watch</td><td>`sum(grpc_server_started_total{grpc_service="etcdserverpb.Watch",grpc_type="bidi_stream"}) - sum(grpc_server_handled_total{grpc_service="etcdserverpb.Watch",grpc_type="bidi_stream"})`</td></tr></table> |
|
||||
|
||||
### Raft 方案
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | <table><tr><td>applied</td><td>`sum(increase(etcd_server_proposals_applied_total[5m])) by (instance)`</td></tr><tr><td>committed</td><td>`sum(increase(etcd_server_proposals_committed_total[5m])) by (instance)`</td></tr><tr><td>pending</td><td>`sum(increase(etcd_server_proposals_pending[5m])) by (instance)`</td></tr><tr><td>failed</td><td>`sum(increase(etcd_server_proposals_failed_total[5m])) by (instance)`</td></tr></table> |
|
||||
| 摘要 | <table><tr><td>applied</td><td>`sum(increase(etcd_server_proposals_applied_total[5m]))`</td></tr><tr><td>committed</td><td>`sum(increase(etcd_server_proposals_committed_total[5m]))`</td></tr><tr><td>pending</td><td>`sum(increase(etcd_server_proposals_pending[5m]))`</td></tr><tr><td>failed</td><td>`sum(increase(etcd_server_proposals_failed_total[5m]))`</td></tr></table> |
|
||||
|
||||
### RPC 速率
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | <table><tr><td>total</td><td>`sum(rate(grpc_server_started_total{grpc_type="unary"}[5m])) by (instance)`</td></tr><tr><td>fail</td><td>`sum(rate(grpc_server_handled_total{grpc_type="unary",grpc_code!="OK"}[5m])) by (instance)`</td></tr></table> |
|
||||
| 摘要 | <table><tr><td>total</td><td>`sum(rate(grpc_server_started_total{grpc_type="unary"}[5m]))`</td></tr><tr><td>fail</td><td>`sum(rate(grpc_server_handled_total{grpc_type="unary",grpc_code!="OK"}[5m]))`</td></tr></table> |
|
||||
|
||||
### 磁盘操作
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | <table><tr><td>commit-called-by-backend</td><td>`sum(rate(etcd_disk_backend_commit_duration_seconds_sum[1m])) by (instance)`</td></tr><tr><td>fsync-called-by-wal</td><td>`sum(rate(etcd_disk_wal_fsync_duration_seconds_sum[1m])) by (instance)`</td></tr></table> |
|
||||
| 摘要 | <table><tr><td>commit-called-by-backend</td><td>`sum(rate(etcd_disk_backend_commit_duration_seconds_sum[1m]))`</td></tr><tr><td>fsync-called-by-wal</td><td>`sum(rate(etcd_disk_wal_fsync_duration_seconds_sum[1m]))`</td></tr></table> |
|
||||
|
||||
### 磁盘同步持续时间
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | <table><tr><td>wal</td><td>`histogram_quantile(0.99, sum(rate(etcd_disk_wal_fsync_duration_seconds_bucket[5m])) by (instance, le))`</td></tr><tr><td>db</td><td>`histogram_quantile(0.99, sum(rate(etcd_disk_backend_commit_duration_seconds_bucket[5m])) by (instance, le))`</td></tr></table> |
|
||||
| 摘要 | <table><tr><td>wal</td><td>`sum(histogram_quantile(0.99, sum(rate(etcd_disk_wal_fsync_duration_seconds_bucket[5m])) by (instance, le)))`</td></tr><tr><td>db</td><td>`sum(histogram_quantile(0.99, sum(rate(etcd_disk_backend_commit_duration_seconds_bucket[5m])) by (instance, le)))`</td></tr></table> |
|
||||
@@ -184,56 +184,56 @@ weight: 6
|
||||
|
||||
### API Server 请求延迟
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | `avg(apiserver_request_latencies_sum / apiserver_request_latencies_count) by (instance, verb) /1e+06` |
|
||||
| 摘要 | `avg(apiserver_request_latencies_sum / apiserver_request_latencies_count) by (instance) /1e+06` |
|
||||
|
||||
### API Server 请求速率
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | `sum(rate(apiserver_request_count[5m])) by (instance, code)` |
|
||||
| 摘要 | `sum(rate(apiserver_request_count[5m])) by (instance)` |
|
||||
|
||||
### 调度失败的 Pod
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | `sum(kube_pod_status_scheduled{condition="false"})` |
|
||||
| 摘要 | `sum(kube_pod_status_scheduled{condition="false"})` |
|
||||
|
||||
### Controller Manager 队列深度
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | <table><tr><td>volumes</td><td>`sum(volumes_depth) by instance`</td></tr><tr><td>deployment</td><td>`sum(deployment_depth) by instance`</td></tr><tr><td>replicaset</td><td>`sum(replicaset_depth) by instance`</td></tr><tr><td>service</td><td>`sum(service_depth) by instance`</td></tr><tr><td>serviceaccount</td><td>`sum(serviceaccount_depth) by instance`</td></tr><tr><td>endpoint</td><td>`sum(endpoint_depth) by instance`</td></tr><tr><td>daemonset</td><td>`sum(daemonset_depth) by instance`</td></tr><tr><td>statefulset</td><td>`sum(statefulset_depth) by instance`</td></tr><tr><td>replicationmanager</td><td>`sum(replicationmanager_depth) by instance`</td></tr></table> |
|
||||
| 摘要 | <table><tr><td>volumes</td><td>`sum(volumes_depth)`</td></tr><tr><td>deployment</td><td>`sum(deployment_depth)`</td></tr><tr><td>replicaset</td><td>`sum(replicaset_depth)`</td></tr><tr><td>service</td><td>`sum(service_depth)`</td></tr><tr><td>serviceaccount</td><td>`sum(serviceaccount_depth)`</td></tr><tr><td>endpoint</td><td>`sum(endpoint_depth)`</td></tr><tr><td>daemonset</td><td>`sum(daemonset_depth)`</td></tr><tr><td>statefulset</td><td>`sum(statefulset_depth)`</td></tr><tr><td>replicationmanager</td><td>`sum(replicationmanager_depth)`</td></tr></table> |
|
||||
|
||||
### 调度器 E2E 调度延迟
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | `histogram_quantile(0.99, sum(scheduler_e2e_scheduling_latency_microseconds_bucket) by (le, instance)) / 1e+06` |
|
||||
| 摘要 | `sum(histogram_quantile(0.99, sum(scheduler_e2e_scheduling_latency_microseconds_bucket) by (le, instance)) / 1e+06)` |
|
||||
|
||||
### 调度器抢占尝试
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | `sum(rate(scheduler_total_preemption_attempts[5m])) by (instance)` |
|
||||
| 摘要 | `sum(rate(scheduler_total_preemption_attempts[5m]))` |
|
||||
|
||||
### Ingress Controller 连接数
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | <table><tr><td>reading</td><td>`sum(nginx_ingress_controller_nginx_process_connections{state="reading"}) by (instance)`</td></tr><tr><td>waiting</td><td>`sum(nginx_ingress_controller_nginx_process_connections{state="waiting"}) by (instance)`</td></tr><tr><td>writing</td><td>`sum(nginx_ingress_controller_nginx_process_connections{state="writing"}) by (instance)`</td></tr><tr><td>accepted</td><td>`sum(ceil(increase(nginx_ingress_controller_nginx_process_connections_total{state="accepted"}[5m]))) by (instance)`</td></tr><tr><td>active</td><td>`sum(ceil(increase(nginx_ingress_controller_nginx_process_connections_total{state="active"}[5m]))) by (instance)`</td></tr><tr><td>handled</td><td>`sum(ceil(increase(nginx_ingress_controller_nginx_process_connections_total{state="handled"}[5m]))) by (instance)`</td></tr></table> |
|
||||
| 摘要 | <table><tr><td>reading</td><td>`sum(nginx_ingress_controller_nginx_process_connections{state="reading"})`</td></tr><tr><td>waiting</td><td>`sum(nginx_ingress_controller_nginx_process_connections{state="waiting"})`</td></tr><tr><td>writing</td><td>`sum(nginx_ingress_controller_nginx_process_connections{state="writing"})`</td></tr><tr><td>accepted</td><td>`sum(ceil(increase(nginx_ingress_controller_nginx_process_connections_total{state="accepted"}[5m])))`</td></tr><tr><td>active</td><td>`sum(ceil(increase(nginx_ingress_controller_nginx_process_connections_total{state="active"}[5m])))`</td></tr><tr><td>handled</td><td>`sum(ceil(increase(nginx_ingress_controller_nginx_process_connections_total{state="handled"}[5m])))`</td></tr></table> |
|
||||
|
||||
### Ingress Controller 请求处理时间
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | `topk(10, histogram_quantile(0.95,sum by (le, host, path)(rate(nginx_ingress_controller_request_duration_seconds_bucket{host!="_"}[5m]))))` |
|
||||
| 摘要 | `topk(10, histogram_quantile(0.95,sum by (le, host)(rate(nginx_ingress_controller_request_duration_seconds_bucket{host!="_"}[5m]))))` |
|
||||
@@ -243,28 +243,28 @@ weight: 6
|
||||
|
||||
### Fluentd 缓冲区队列速率
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | `sum(rate(fluentd_output_status_buffer_queue_length[5m])) by (instance)` |
|
||||
| 摘要 | `sum(rate(fluentd_output_status_buffer_queue_length[5m]))` |
|
||||
|
||||
### Fluentd 输入速率
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | `sum(rate(fluentd_input_status_num_records_total[5m])) by (instance)` |
|
||||
| 摘要 | `sum(rate(fluentd_input_status_num_records_total[5m]))` |
|
||||
|
||||
### Fluentd 输出错误率
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | `sum(rate(fluentd_output_status_num_errors[5m])) by (type)` |
|
||||
| 摘要 | `sum(rate(fluentd_output_status_num_errors[5m]))` |
|
||||
|
||||
### Fluentd 输出速率
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | `sum(rate(fluentd_output_status_num_records_total[5m])) by (instance)` |
|
||||
| 摘要 | `sum(rate(fluentd_output_status_num_records_total[5m]))` |
|
||||
@@ -273,35 +273,35 @@ weight: 6
|
||||
|
||||
### 工作负载 CPU 利用率
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | <table><tr><td>cfs throttled seconds</td><td>`sum(rate(container_cpu_cfs_throttled_seconds_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m])) by (pod_name)`</td></tr><tr><td>user seconds</td><td>`sum(rate(container_cpu_user_seconds_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m])) by (pod_name)`</td></tr><tr><td>system seconds</td><td>`sum(rate(container_cpu_system_seconds_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m])) by (pod_name)`</td></tr><tr><td>usage seconds</td><td>`sum(rate(container_cpu_usage_seconds_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m])) by (pod_name)`</td></tr></table> |
|
||||
| 摘要 | <table><tr><td>cfs throttled seconds</td><td>`sum(rate(container_cpu_cfs_throttled_seconds_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m]))`</td></tr><tr><td>user seconds</td><td>`sum(rate(container_cpu_user_seconds_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m]))`</td></tr><tr><td>system seconds</td><td>`sum(rate(container_cpu_system_seconds_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m]))`</td></tr><tr><td>usage seconds</td><td>`sum(rate(container_cpu_usage_seconds_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m]))`</td></tr></table> |
|
||||
|
||||
### 工作负载内存利用率
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | `sum(container_memory_working_set_bytes{namespace="$namespace",pod_name=~"$podName", container_name!=""}) by (pod_name)` |
|
||||
| 摘要 | `sum(container_memory_working_set_bytes{namespace="$namespace",pod_name=~"$podName", container_name!=""})` |
|
||||
|
||||
### 工作负载网络数据包
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | <table><tr><td>receive-packets</td><td>`sum(rate(container_network_receive_packets_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m])) by (pod_name)`</td></tr><tr><td>receive-dropped</td><td>`sum(rate(container_network_receive_packets_dropped_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m])) by (pod_name)`</td></tr><tr><td>receive-errors</td><td>`sum(rate(container_network_receive_errors_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m])) by (pod_name)`</td></tr><tr><td>transmit-packets</td><td>`sum(rate(container_network_transmit_packets_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m])) by (pod_name)`</td></tr><tr><td>transmit-dropped</td><td>`sum(rate(container_network_transmit_packets_dropped_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m])) by (pod_name)`</td></tr><tr><td>transmit-errors</td><td>`sum(rate(container_network_transmit_errors_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m])) by (pod_name)`</td></tr></table> |
|
||||
| 摘要 | <table><tr><td>receive-packets</td><td>`sum(rate(container_network_receive_packets_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m]))`</td></tr><tr><td>receive-dropped</td><td>`sum(rate(container_network_receive_packets_dropped_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m]))`</td></tr><tr><td>receive-errors</td><td>`sum(rate(container_network_receive_errors_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m]))`</td></tr><tr><td>transmit-packets</td><td>`sum(rate(container_network_transmit_packets_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m]))`</td></tr><tr><td>transmit-dropped</td><td>`sum(rate(container_network_transmit_packets_dropped_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m]))`</td></tr><tr><td>transmit-errors</td><td>`sum(rate(container_network_transmit_errors_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m]))`</td></tr></table> |
|
||||
|
||||
### 工作负载网络 I/O
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | <table><tr><td>receive</td><td>`sum(rate(container_network_receive_bytes_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m])) by (pod_name)`</td></tr><tr><td>transmit</td><td>`sum(rate(container_network_transmit_bytes_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m])) by (pod_name)`</td></tr></table> |
|
||||
| 摘要 | <table><tr><td>receive</td><td>`sum(rate(container_network_receive_bytes_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m]))`</td></tr><tr><td>transmit</td><td>`sum(rate(container_network_transmit_bytes_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m]))`</td></tr></table> |
|
||||
|
||||
### 工作负载磁盘 I/O
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | <table><tr><td>read</td><td>`sum(rate(container_fs_reads_bytes_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m])) by (pod_name)`</td></tr><tr><td>write</td><td>`sum(rate(container_fs_writes_bytes_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m])) by (pod_name)`</td></tr></table> |
|
||||
| 摘要 | <table><tr><td>read</td><td>`sum(rate(container_fs_reads_bytes_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m]))`</td></tr><tr><td>write</td><td>`sum(rate(container_fs_writes_bytes_total{namespace="$namespace",pod_name=~"$podName",container_name!=""}[5m]))`</td></tr></table> |
|
||||
@@ -310,35 +310,35 @@ weight: 6
|
||||
|
||||
### Pod CPU 利用率
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | <table><tr><td>cfs throttled seconds</td><td>`sum(rate(container_cpu_cfs_throttled_seconds_total{container_name!="POD",namespace="$namespace",pod_name="$podName", container_name!=""}[5m])) by (container_name)`</td></tr><tr><td>usage seconds</td><td>`sum(rate(container_cpu_usage_seconds_total{container_name!="POD",namespace="$namespace",pod_name="$podName", container_name!=""}[5m])) by (container_name)`</td></tr><tr><td>system seconds</td><td>`sum(rate(container_cpu_system_seconds_total{container_name!="POD",namespace="$namespace",pod_name="$podName", container_name!=""}[5m])) by (container_name)`</td></tr><tr><td>user seconds</td><td>`sum(rate(container_cpu_user_seconds_total{container_name!="POD",namespace="$namespace",pod_name="$podName", container_name!=""}[5m])) by (container_name)`</td></tr></table> |
|
||||
| 摘要 | <table><tr><td>cfs throttled seconds</td><td>`sum(rate(container_cpu_cfs_throttled_seconds_total{container_name!="POD",namespace="$namespace",pod_name="$podName", container_name!=""}[5m]))`</td></tr><tr><td>usage seconds</td><td>`sum(rate(container_cpu_usage_seconds_total{container_name!="POD",namespace="$namespace",pod_name="$podName", container_name!=""}[5m]))`</td></tr><tr><td>system seconds</td><td>`sum(rate(container_cpu_system_seconds_total{container_name!="POD",namespace="$namespace",pod_name="$podName", container_name!=""}[5m]))`</td></tr><tr><td>user seconds</td><td>`sum(rate(container_cpu_user_seconds_total{container_name!="POD",namespace="$namespace",pod_name="$podName", container_name!=""}[5m]))`</td></tr></table> |
|
||||
|
||||
### Pod 内存利用率
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | `sum(container_memory_working_set_bytes{container_name!="POD",namespace="$namespace",pod_name="$podName",container_name!=""}) by (container_name)` |
|
||||
| 摘要 | `sum(container_memory_working_set_bytes{container_name!="POD",namespace="$namespace",pod_name="$podName",container_name!=""})` |
|
||||
|
||||
### Pod 网络数据包
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | <table><tr><td>receive-packets</td><td>`sum(rate(container_network_receive_packets_total{namespace="$namespace",pod_name="$podName",container_name!=""}[5m]))`</td></tr><tr><td>receive-dropped</td><td>`sum(rate(container_network_receive_packets_dropped_total{namespace="$namespace",pod_name="$podName",container_name!=""}[5m]))`</td></tr><tr><td>receive-errors</td><td>`sum(rate(container_network_receive_errors_total{namespace="$namespace",pod_name="$podName",container_name!=""}[5m]))`</td></tr><tr><td>transmit-packets</td><td>`sum(rate(container_network_transmit_packets_total{namespace="$namespace",pod_name="$podName",container_name!=""}[5m]))`</td></tr><tr><td>transmit-dropped</td><td>`sum(rate(container_network_transmit_packets_dropped_total{namespace="$namespace",pod_name="$podName",container_name!=""}[5m]))`</td></tr><tr><td>transmit-errors</td><td>`sum(rate(container_network_transmit_errors_total{namespace="$namespace",pod_name="$podName",container_name!=""}[5m]))`</td></tr></table> |
|
||||
| 摘要 | <table><tr><td>receive-packets</td><td>`sum(rate(container_network_receive_packets_total{namespace="$namespace",pod_name="$podName",container_name!=""}[5m]))`</td></tr><tr><td>receive-dropped</td><td>`sum(rate(container_network_receive_packets_dropped_total{namespace="$namespace",pod_name="$podName",container_name!=""}[5m]))`</td></tr><tr><td>receive-errors</td><td>`sum(rate(container_network_receive_errors_total{namespace="$namespace",pod_name="$podName",container_name!=""}[5m]))`</td></tr><tr><td>transmit-packets</td><td>`sum(rate(container_network_transmit_packets_total{namespace="$namespace",pod_name="$podName",container_name!=""}[5m]))`</td></tr><tr><td>transmit-dropped</td><td>`sum(rate(container_network_transmit_packets_dropped_total{namespace="$namespace",pod_name="$podName",container_name!=""}[5m]))`</td></tr><tr><td>transmit-errors</td><td>`sum(rate(container_network_transmit_errors_total{namespace="$namespace",pod_name="$podName",container_name!=""}[5m]))`</td></tr></table> |
|
||||
|
||||
### Pod 网络 I/O
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | <table><tr><td>receive</td><td>`sum(rate(container_network_receive_bytes_total{namespace="$namespace",pod_name="$podName",container_name!=""}[5m]))`</td></tr><tr><td>transmit</td><td>`sum(rate(container_network_transmit_bytes_total{namespace="$namespace",pod_name="$podName",container_name!=""}[5m]))`</td></tr></table> |
|
||||
| 摘要 | <table><tr><td>receive</td><td>`sum(rate(container_network_receive_bytes_total{namespace="$namespace",pod_name="$podName",container_name!=""}[5m]))`</td></tr><tr><td>transmit</td><td>`sum(rate(container_network_transmit_bytes_total{namespace="$namespace",pod_name="$podName",container_name!=""}[5m]))`</td></tr></table> |
|
||||
|
||||
### Pod 磁盘 I/O
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| 详情 | <table><tr><td>read</td><td>`sum(rate(container_fs_reads_bytes_total{namespace="$namespace",pod_name="$podName",container_name!=""}[5m])) by (container_name)`</td></tr><tr><td>write</td><td>`sum(rate(container_fs_writes_bytes_total{namespace="$namespace",pod_name="$podName",container_name!=""}[5m])) by (container_name)`</td></tr></table> |
|
||||
| 摘要 | <table><tr><td>read</td><td>`sum(rate(container_fs_reads_bytes_total{namespace="$namespace",pod_name="$podName",container_name!=""}[5m]))`</td></tr><tr><td>write</td><td>`sum(rate(container_fs_writes_bytes_total{namespace="$namespace",pod_name="$podName",container_name!=""}[5m]))`</td></tr></table> |
|
||||
@@ -347,7 +347,7 @@ weight: 6
|
||||
|
||||
### 容器 CPU 利用率
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| cfs throttled seconds | `sum(rate(container_cpu_cfs_throttled_seconds_total{namespace="$namespace",pod_name="$podName",container_name="$containerName"}[5m]))` |
|
||||
| usage seconds | `sum(rate(container_cpu_usage_seconds_total{namespace="$namespace",pod_name="$podName",container_name="$containerName"}[5m]))` |
|
||||
@@ -360,7 +360,7 @@ weight: 6
|
||||
|
||||
### 容器磁盘 I/O
|
||||
|
||||
| 目录 | 表达式 |
|
||||
| Catalog | 表达式 |
|
||||
| --- | --- |
|
||||
| read | `sum(rate(container_fs_reads_bytes_total{namespace="$namespace",pod_name="$podName",container_name="$containerName"}[5m]))` |
|
||||
| write | `sum(rate(container_fs_writes_bytes_total{namespace="$namespace",pod_name="$podName",container_name="$containerName"}[5m]))` |
|
||||
|
||||
+2
@@ -165,7 +165,9 @@ Rancher 部署的默认角色(即 cluster-owner、cluster-member、project-own
|
||||
1. 点击 **Grafana**。
|
||||
|
||||
<figcaption>Grafana 中的集群计算资源仪表板</figcaption>
|
||||
|
||||

|
||||
|
||||
<figcaption>Grafana 中的默认仪表板</figcaption>
|
||||
|
||||

|
||||
+2
@@ -82,9 +82,11 @@ NeuVector 安全解决方案包含四种类型的安全容器,分别是 Contro
|
||||
- **Updater**:更新 Neuvector 的 CVE 数据库(运行的时候);重新部署 scanner pod。
|
||||
|
||||
<figcaption>**NeuVector 安全容器:**</figcaption>
|
||||
|
||||

|
||||
|
||||
<figcaption>**NeuVector 架构:**</figcaption>
|
||||
|
||||

|
||||
|
||||
要了解有关 NeuVector 架构的更多信息,请参阅[此处](https://open-docs.neuvector.com/basics/overview#architecture)。
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ Rancher 是一个为使用容器的公司打造的容器管理平台。Rancher
|
||||
|
||||
# Run Kubernetes Everywhere
|
||||
|
||||
Kubernetes 已经成为容器编排标准。现在,大多数云和虚拟化提供商都提供容器编排服务。Rancher 用户可以选择使用 Rancher Kubernetes Engine(RKE)或云 Kubernetes 服务(例如 GKE、AKS 和 EKS)创建 Kubernetes 集群。还可以导入和管理使用任何 Kubernetes 发行版或安装程序创建的现有 Kubernetes 集群。
|
||||
Kubernetes 已经成为容器编排标准。现在,大多数云和虚拟化提供商都提供容器编排服务。Rancher 用户可以选择使用 Rancher Kubernetes Engine(RKE)或云 Kubernetes 服务(例如 GKE、AKS 和 EKS)创建 Kubernetes 集群,还可以导入和管理使用任何 Kubernetes 发行版或安装程序创建的现有 Kubernetes 集群。
|
||||
|
||||
# 满足 IT 需求规范
|
||||
|
||||
@@ -39,7 +39,7 @@ Rancher API Server 是基于嵌入式 Kubernetes API Server 和 etcd 数据库
|
||||
- **配置 Kubernetes 集群**:Rancher API Server 可以在已有节点上[配置 Kubernetes](../../pages-for-subheaders/kubernetes-clusters-in-rancher-setup.md),或进行 [Kubernetes 版本升级](../installation-and-upgrade/upgrade-and-roll-back-kubernetes.md)。
|
||||
- **管理应用商店**:Rancher 支持使用 [Helm Chart 应用商店](../../pages-for-subheaders/helm-charts-in-rancher.md)实现轻松重复部署应用。
|
||||
- **管理项目**:项目由集群中多个命名空间和访问控制策略组成,是 Rancher 中的一个概念,Kubernetes 中并没有这个概念。你可以使用项目实现以组为单位,管理多个命名空间,并进行 Kubernetes 相关操作。Rancher UI 提供用于[项目管理](../../pages-for-subheaders/manage-projects.md)和[项目内应用管理](../../pages-for-subheaders/kubernetes-resources-setup.md)的功能。
|
||||
- **流水线**:[流水线](../../how-to-guides/advanced-user-guides/manage-projects/ci-cd-pipelines.md)可以帮助开发者快速高效地上线新软件。Rancher 支持给每个项目单独设置流水线。
|
||||
- **Fleet 持续交付**:在 Rancher 中,你可以使用 [Fleet 持续交付](../../pages-for-subheaders/fleet-gitops-at-scale.md)将应用程序从 Git 仓库部署到目标下游 Kubernetes 集群,无需任何手动操作。
|
||||
- **Istio**:[Rancher 与 Istio 集成](../../pages-for-subheaders/istio.md),使得管理员或集群所有者可以将 Istio 交给开发者,然后开发者使用 Istio 执行安全策略,排查问题,或为蓝绿部署,金丝雀部署,和 A/B 测试进行流量管理。
|
||||
|
||||
### 配置云基础设施
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ title: Divio 文档介绍
|
||||
|
||||
[Divio 文档系统](https://documentation.divio.com/)是一种软件文档范式,它以功能为基础,旨在为用户提供具体、简明而且目的明确的文档。一般来说,Divio 由四个类别组成,分别是教程、操作指南、参考指南和解释。
|
||||
|
||||
我们将文档划分为以下章节:
|
||||
我们将文档划分为[开始使用](../../getting-started.md)、[操作指南](../../how-to-guides.md)(包括[新用户指南](../../pages-for-subheaders/new-user-guides.md)和[高级用户指南](../../pages-for-subheaders/advanced-user-guides.md))、[参考指南](../../reference-guides.md)、[说明](../../explanations.md)、[常见问题](../../faq.md)、[故障排除](../../troubleshooting.md),以及[参与 Rancher 社区贡献](../../contribute-to-rancher.md)几个部分。
|
||||
|
||||
|
||||
## 开始使用
|
||||
|
||||
+3
-3
@@ -81,9 +81,9 @@ weight: 1200
|
||||
| 私钥/证书 | 在 Rancher 和你的 IdP 之间创建安全外壳(SSH)的密钥/证书对。如果你的 Keycloak 服务器上启用了 HTTPS/SSL,则为必填。 |
|
||||
| 端点 | 选择为 `Rancher URL`、`发行者`和 `Auth 端点`字段使用生成的值,还是在不正确时进行手动覆盖。 |
|
||||
| Keycloak URL | 你的 Keycloak 服务器的 URL。 |
|
||||
| Keycloak Realm | 创建 Keycloak 客户端的领域的名称。 |
|
||||
| Keycloak Realm | 创建 Keycloak 客户端的 Realm 的名称。 |
|
||||
| Rancher URL | Rancher Server 的 URL。 |
|
||||
| 发行者 | 你的 IdP 的 URL。 |
|
||||
| Issuer | 你的 IdP 的 URL。 |
|
||||
| Auth 端点 | 重定向用户进行身份验证的 URL。 |
|
||||
|
||||
## 从 SAML 迁移到 OIDC
|
||||
@@ -136,7 +136,7 @@ weight: 1200
|
||||
|
||||
* 验证你的 Keycloak 客户端配置。
|
||||
|
||||
### 生成的`发行者`和 `Auth 端点`不正确
|
||||
### 生成的 `Issuer` 和 `Auth 端点`不正确
|
||||
|
||||
* 在**配置 Keycloak OIDC 账号**表单中,将**端点**更改为`指定(高级设置)`并覆盖`发行者` 和 `Auth 端点`的值。要查找这些值,前往 Keycloak 控制台并选择 **Realm Settings**,选择 **General** 选项卡,然后单击 **OpenID Endpoint Configuration**。JSON 输出将显示 `issuer` 和 `authorization_endpoint` 的值。
|
||||
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ weight: 32
|
||||
|
||||
:::note 重要提示:
|
||||
|
||||
如果管理员将 `cluster-template-enforcement` 设置为 <b>True</b>,还需要与用户共享`clusterTemplates`,以便用户可以选择其中一个模板来创建集群。
|
||||
如果管理员将 `cluster-template-enforcement` 设置为 <b>True</b>,还需要与用户共享 `clusterTemplates`,以便用户可以选择其中一个模板来创建集群。
|
||||
|
||||
:::
|
||||
|
||||
|
||||
+1
-1
@@ -66,6 +66,6 @@ Bob 是一位高级用户,可以就集群配置做出明智的决策。随着
|
||||
|
||||
- 当最佳实践发生变化时[修改模板](manage-rke1-templates.md#更新模板)
|
||||
- [禁用模板的过时修订](manage-rke1-templates.md#禁用模板修订版),以禁止使用该模板来创建集群
|
||||
- 如果组织想要改变方向,则[删除整个模板](manage-rke1-templates.md##删除模板)
|
||||
- 如果组织想要改变方向,则[删除整个模板](manage-rke1-templates.md#删除模板)
|
||||
- [将某个版本设置为默认值](manage-rke1-templates.md#将模板修订版设置为默认),用于用户创建集群。模板的最终用户仍然可以选择他们想要使用哪个版本来创建集群。
|
||||
- [与特定用户共享模板](access-or-share-templates.md),让所有 Rancher 用户都可以使用该模板,或与其他用户共享该模板的所有权。
|
||||
+6
-6
@@ -34,19 +34,19 @@ weight: 2020
|
||||
|
||||
- 在你键入时,Rancher 会从你的[外部身份验证](../../../../pages-for-subheaders/about-authentication.md)源返回用户。
|
||||
|
||||
:::note 使用 AD 但找不到你的用户?
|
||||
:::note 使用 AD 但找不到你的用户?
|
||||
|
||||
你的搜索属性配置可能存在问题。请参阅[配置 Active Directory 身份验证:步骤 5](../../authentication-permissions-and-global-configuration/about-authentication/authentication-config/configure-active-directory.md)。
|
||||
你的搜索属性配置可能存在问题。请参阅[配置 Active Directory 身份验证:步骤 5](../../authentication-permissions-and-global-configuration/about-authentication/authentication-config/configure-active-directory.md)。
|
||||
|
||||
:::
|
||||
:::
|
||||
|
||||
- 你可以在下拉菜单中添加组,而不是单个用户。下拉列表仅列出你(登录用户)所属的组。
|
||||
|
||||
:::note
|
||||
:::note
|
||||
|
||||
如果你以本地用户身份登录,外部用户不会显示在你的搜索结果中。有关详细信息,请参阅[外部身份验证配置和主体用户](../../../../pages-for-subheaders/about-authentication.md#外部身份验证配置和用户主体)。
|
||||
如果你以本地用户身份登录,外部用户不会显示在你的搜索结果中。有关详细信息,请参阅[外部身份验证配置和主体用户](../../../../pages-for-subheaders/about-authentication.md#外部身份验证配置和用户主体)。
|
||||
|
||||
:::
|
||||
:::
|
||||
|
||||
1. 分配用户或组的**集群**角色。
|
||||
|
||||
|
||||
+1
-1
@@ -21,6 +21,6 @@ _Pod 安全策略_(PSP)是控制 Pod 安全的规范(如是否可以使用
|
||||
|
||||
:::
|
||||
|
||||
要启用默认 Pod 安全策略,请将 **Pod 安全策略支持** 选项设置为**启用**,然后从**默认 Pod 安全策略**下拉框中进行选择。
|
||||
要启用默认 Pod 安全策略,请将 **Pod 安全策略支持**选项设置为**启用**,然后从**默认 Pod 安全策略**下拉框中进行选择。
|
||||
|
||||
集群完成配置后,你选择的 PSP 将应用于集群内的所有项目。
|
||||
|
||||
+2
-2
@@ -63,7 +63,7 @@ $ sudo shutdown -r now
|
||||
将注册集群分离 Rancher 后,集群的工作负载将不受影响,你可以使用与集群注册到 Rancher 之前相同的方法来访问集群。
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="By UI / API">
|
||||
<TabItem value="使用 UI/API">
|
||||
|
||||
:::danger
|
||||
|
||||
@@ -82,7 +82,7 @@ $ sudo shutdown -r now
|
||||
**结果**:已删除[移除了什么](#移除了什么)章节中为注册集群列出的所有组件。
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="By Script">
|
||||
<TabItem value="使用脚本">
|
||||
|
||||
你可以运行脚本,而不是使用 Rancher UI 来清理已注册的集群节点。
|
||||
|
||||
|
||||
+2
@@ -10,6 +10,7 @@ Rancher 中的资源配额包含与 [Kubernetes 原生版本](https://kubernetes
|
||||
在下图中,Kubernetes 管理员试图在没有 Rancher 的情况下强制执行资源配额。管理员想要使用一个资源配额来为集群中的每个命名空间配置统一的 CPU 和内存限制 (`Namespace 1-4`)。但是,在 Kubernetes 的基础版本中,每个命名空间都需要单独设置资源配额。因此,管理员必须创建四个配置相同规格的不同资源配额(`Resource Quota 1-4`)并单独应用这些配额。
|
||||
|
||||
<sup>Kubernetes 基础版本:每个命名空间都需要独立设置资源配额</sup>
|
||||
|
||||

|
||||
|
||||
和原生 Kubernetes 相比,Rancher 的资源配额有不同。在 Rancher 中,你可以把资源配额应用到项目层级,进而让项目的资源配额沿用到项目内的每一个命名空间,然后 Kubernetes 会使用原生的资源配额来强制执行你设置的限制。如果要更改特定命名空间的配额,你也可以覆盖设置。
|
||||
@@ -30,6 +31,7 @@ Rancher 中的资源配额包含与 [Kubernetes 原生版本](https://kubernetes
|
||||
在下图中,Rancher 管理员想使用资源配额来为项目中的每个命名空间(`命名空间 1-4`)设置相同的 CPU 和内存限制。在 Rancher 中,管理员可以为项目设置资源配额(`项目资源配额`),而不需要为命名空间单独进行设置。此配额包括整个项目(`项目限制`)和单个命名空间(`命名空间默认限制`)的资源限制。然后,Rancher 会将`命名空间默认限制`的配额沿用到每个命名空间(`命名空间资源配额`)。
|
||||
|
||||
<sup>Rancher:资源配额沿用到每个命名空间</sup>
|
||||
|
||||

|
||||
|
||||
以下介绍在 Rancher UI **_中_** 创建的命名空间的更细微的功能。如果你删除了项目级别的资源配额,无论命名空间层级是否有自定义的资源配额,项目内的所有命名空间也会移除这个资源配额。在项目层级修改已有的命名空间默认资源配额,不会影响命名空间内的资源配额,修改后的项目层级资源配额只会对以后新建的命名空间生效。要修改多个现有命名空间的默认限制,你可以在项目层级删除该限制,然后再使用新的默认值重新创建配额。这种方式会将新的默认值应用于项目中的所有现有命名空间。
|
||||
|
||||
+1
@@ -8,6 +8,7 @@ weight: 2
|
||||
在下图中,Rancher 管理员的项目有一个已生效的资源配额。但是,管理员想要覆盖 `Namespace 3` 的命名空间限制,以便让该命名空间使用更多资源。因此,管理员[提高了 `Namespace 3` 的命名空间限制](../../manage-clusters/projects-and-namespaces.md),以便命名空间可以访问更多资源。
|
||||
|
||||
<sup>命名空间默认限制覆盖</sup>
|
||||
|
||||

|
||||
|
||||
有关详细信息,请参阅[如何编辑命名空间资源配额](../../manage-clusters/projects-and-namespaces.md)。
|
||||
|
||||
+3
-3
@@ -65,9 +65,9 @@ Prometheus 规则文件保存在 PrometheusRule 自定义资源中。PrometheusR
|
||||
| 告警名称 | 告警的名称。必须是有效的标签值。 |
|
||||
| 告警触发等待时间 | 时长,以秒为单位。当告警触发时间到达该指定时长时,则视为触发。当告警未触发足够长的时间,则视为待处理。 |
|
||||
| PromQL 表达式 | 要评估的 PromQL 表达式。Prometheus 将在每个评估周期评估此 PromQL 表达式的当前值,并且所有生成的时间序列都将成为待处理/触发告警。有关详细信息,请参阅 [Prometheus 文档](https://prometheus.io/docs/prometheus/latest/querying/basics/)或我们的 [PromQL 表达式示例](../../../../explanations/integrations-in-rancher/monitoring-and-alerting/promql-expressions.md)。 |
|
||||
| 标签 | 为每个告警添加或覆盖的标签。 |
|
||||
| Labels | 为每个告警添加或覆盖的标签。 |
|
||||
| 严重程度 | 启用后,标签会附加到告警或记录中,这些标签通过严重程度来标识告警/记录。 |
|
||||
| 严重标签值 | Critical,warning 或 none |
|
||||
| 严重程度 Label 值 | Critical,warning 或 none |
|
||||
| 注释 | 注释是一组信息标签,可用于存储更长的附加信息,例如告警描述或 Runbook 链接。[Runbook](https://en.wikipedia.org/wiki/Runbook) 是一组有关如何处理告警的文档。注释值可以是[模板化](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/#templating)的。 |
|
||||
|
||||
### 记录规则
|
||||
@@ -78,4 +78,4 @@ Prometheus 规则文件保存在 PrometheusRule 自定义资源中。PrometheusR
|
||||
|-------|----------------|
|
||||
| 时间序列名称 | 要输出的时间序列的名称。必须是有效的指标名称。 |
|
||||
| PromQL 表达式 | 要评估的 PromQL 表达式。Prometheus 将在每个评估周期评估此 PromQL 表达式的当前值,并且将结果记录为一组新的时间序列,其指标名称由“记录”指定。有关表达式的更多信息,请参阅 [Prometheus 文档](https://prometheus.io/docs/prometheus/latest/querying/basics/)或我们的 [PromQL 表达式示例](../../../../explanations/integrations-in-rancher/monitoring-and-alerting/promql-expressions.md)。 |
|
||||
| 标签 | 在存储结果之前要添加或覆盖的标签。 |
|
||||
| Labels | 在存储结果之前要添加或覆盖的标签。 |
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ helm repo update
|
||||
helm install rancher-backup-crd rancher-charts/rancher-backup-crd -n cattle-resources-system --create-namespace --version $CHART_VERSION
|
||||
helm install rancher-backup rancher-charts/rancher-backup -n cattle-resources-system --version $CHART_VERSION
|
||||
```
|
||||
<br/>
|
||||
|
||||
如果是**离线环境**,在安装 `rancher-backup-crd` Helm Chart 时,使用以下选项从私有镜像仓库拉取 `backup-restore-operator` 镜像:
|
||||
```
|
||||
--set image.repository $REGISTRY/rancher/backup-restore-operator
|
||||
|
||||
+14
-14
@@ -45,20 +45,20 @@ Rancher 将在运行 `cleanup` 脚本时关闭,因为它会删除 Rancher 创
|
||||
|
||||
```yaml
|
||||
apiVersion: resources.cattle.io/v1
|
||||
kind: Restore
|
||||
metadata:
|
||||
name: restore-migration
|
||||
spec:
|
||||
backupFilename: backup-b0450532-cee1-4aa1-a881-f5f48a007b1c-2020-09-15T07-27-09Z.tar.gz
|
||||
encryptionConfigSecretName: encryptionconfig
|
||||
storageLocation:
|
||||
s3:
|
||||
credentialSecretName: s3-creds
|
||||
credentialSecretNamespace: default
|
||||
bucketName: rancher-backups
|
||||
folder: rancher
|
||||
region: us-west-2
|
||||
endpoint: s3.us-west-2.amazonaws.com
|
||||
kind: Restore
|
||||
metadata:
|
||||
name: restore-migration
|
||||
spec:
|
||||
backupFilename: backup-b0450532-cee1-4aa1-a881-f5f48a007b1c-2020-09-15T07-27-09Z.tar.gz
|
||||
encryptionConfigSecretName: encryptionconfig
|
||||
storageLocation:
|
||||
s3:
|
||||
credentialSecretName: s3-creds
|
||||
credentialSecretNamespace: default
|
||||
bucketName: rancher-backups
|
||||
folder: rancher
|
||||
region: us-west-2
|
||||
endpoint: s3.us-west-2.amazonaws.com
|
||||
```
|
||||
|
||||
如需获得配置 Restore 的帮助,请参见[配置参考](../../../reference-guides/backup-restore-configuration/restore-configuration.md)和[示例](../../../reference-guides/backup-restore-configuration/examples.md)。
|
||||
|
||||
+2
-1
@@ -21,5 +21,6 @@ Rancher Server 的数据存储在 etcd 中。etcd 数据库可以在所有三个
|
||||
- Ingress Controller 会把流量转发到 Rancher deployment 的 Pod 上的 TCP/80 端口。
|
||||
|
||||
<figcaption>使用 4 层负载均衡器在 Kubernetes 集群中安装 Rancher:Ingress Controller 的 SSL 终止:</figcaption>
|
||||

|
||||
|
||||

|
||||
<sup>使用 4 层负载均衡器在 Kubernetes 集群中安装 Rancher:Ingress Controller 的 SSL 终止</sup>
|
||||
|
||||
+1
@@ -272,6 +272,7 @@ spec:
|
||||
|
||||
|
||||
## 将工作负载迁移到 RKE2 Windows 的指南
|
||||
|
||||
参考[对比 Rancher 2.5 与 Rancher 2.6:Windows 集群的支持矩阵](#对比-rancher-25-与-rancher-26windows-集群的支持矩阵)和[对比 Rancher 2.5 与 Rancher 2.6:支持用于配置 RKE1 和 RKE2 Windows 集群的 Kubernetes 版本](#对比-rancher-25-与-rancher-26支持用于配置-rke1-和-rke2-windows-集群的-kubernetes-版本)中的表格,你会发现 RKE1 和 RKE2 的 Kubernetes 1.22 版本发生了重叠。因此,当遵循 Rancher 推荐的方法时,这将是迁移 RKE1 Windows 工作负载所需的基本版本。
|
||||
|
||||
### Rancher 2.5 的就地升级
|
||||
|
||||
+40
-1
@@ -1 +1,40 @@
|
||||
<!-- PLACEHOLDER -->
|
||||
---
|
||||
title: Horizontal Pod Autoscaler 介绍
|
||||
weight: 3027
|
||||
---
|
||||
|
||||
[Horizontal Pod Autoscaler(HPA)](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/)是一项 Kubernetes 功能,用于将集群配置为自动扩缩其运行的服务。本节介绍 HPA 如何与 Kubernetes 一起工作。
|
||||
|
||||
## 为什么要使用 Horizontal Pod Autoscaler?
|
||||
|
||||
你可以使用 HPA 来自动扩缩 ReplicationController、Deployment 或 ReplicaSet 中的 pod 数量。HPA 会自动扩缩正在运行的 pod 数量以实现最高效率。影响 pod 数量的因素包括:
|
||||
|
||||
- 允许运行的最小和最大 pod 数,由用户定义。
|
||||
- 资源指标中报告的 CPU/内存使用情况。
|
||||
- 第三方指标应用程序(如 Prometheus、Datadog 等)提供的自定义指标。
|
||||
|
||||
HPA 通过以下方式改进你的服务:
|
||||
|
||||
- 释放硬件资源,避免资源被过多的 pod 浪费。
|
||||
- 按需提高/降低性能以达到服务级别协议。
|
||||
|
||||
## HPA 的工作原理
|
||||
|
||||

|
||||
|
||||
HPA 实现为一个控制循环,其周期由以下 `kube-controller-manager` 标志控制:
|
||||
|
||||
| 标志 | 默认 | 描述 |
|
||||
---------|----------|----------|
|
||||
| `--horizontal-pod-autoscaler-sync-period` | `30s` | HPA 在 deployment 中审核资源/自定义指标的频率。 |
|
||||
| `--horizontal-pod-autoscaler-downscale-delay` | `5m0s` | 完成缩减操作后,HPA 必须等待多长时间才能启动另一个缩减操作。 |
|
||||
| `--horizontal-pod-autoscaler-upscale-delay` | `3m0s` | 完成扩展操作后,HPA 必须等待多长时间才能启动另一个扩展操作。 |
|
||||
|
||||
|
||||
有关 HPA 的完整文档,请参阅 [Kubernetes 文档](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/)。
|
||||
|
||||
## Horizontal Pod Autoscaler API 对象
|
||||
|
||||
HPA 是 Kubernetes `autoscaling` API 组中的 API 资源。当前的稳定版本是 `autoscaling/v1`,它只支持对 CPU 自动扩缩。要获得内存和自定义指标的扩缩支持,请改用 beta 版本 `autoscaling/v2beta1`。
|
||||
|
||||
有关 HPA API 对象的更多信息,请参阅 [HPA GitHub 自述文件](https://git.k8s.io/community/contributors/design-proposals/autoscaling/horizontal-pod-autoscaler.md#horizontalpodautoscaler-object)。
|
||||
|
||||
+205
-1
@@ -1 +1,205 @@
|
||||
<!-- PLACEHOLDER -->
|
||||
---
|
||||
title: 使用 kubectl 管理 HPA
|
||||
weight: 3029
|
||||
---
|
||||
|
||||
本文介绍如何使用 `kubectl` 管理 HPA。本文对以下操作进行了说明:
|
||||
|
||||
- 创建 HPA
|
||||
- 获取 HPA 的信息
|
||||
- 删除 HPA
|
||||
- 配置 HPA 以根据 CPU 或内存利用率进行扩缩
|
||||
- 如果你使用 Prometheus 等第三方工具的指标,配置 HPA 以使用自定义指标进行扩缩
|
||||
|
||||
|
||||
你可以在 Rancher UI 中创建、查看和删除 HPA。你还可以根据 Rancher UI 中的 CPU/内存使用情况进行扩缩。有关详细信息,请参阅[使用 Rancher UI 管理 HPA](./manage-hpas-with-ui.md)。如果要使用 CPU/内存以外的指标来扩缩 HPA,你需要使用 `kubectl`。
|
||||
|
||||
## 管理 HPA 的基本 kubectl 命令
|
||||
|
||||
如果你有 HPA 清单文件,则可以使用 `kubectl` 来创建、管理和删除 HPA:
|
||||
|
||||
- 创建 HPA
|
||||
|
||||
- 有清单:`kubectl create -f <HPA_MANIFEST>`
|
||||
|
||||
- 没有清单(仅支持 CPU):`kubectl autoscale deployment hello-world --min=2 --max=5 --cpu-percent=50`
|
||||
|
||||
- 获取 HPA 信息
|
||||
|
||||
- 基本:`kubectl get hpa hello-world`
|
||||
|
||||
- 详细描述:`kubectl describe hpa hello-world`
|
||||
|
||||
- 删除 HPA
|
||||
|
||||
- `kubectl delete hpa hello-world`
|
||||
|
||||
## HPA 清单定义示例
|
||||
|
||||
HPA 清单是用于使用 `kubectl` 管理 HPA 的配置文件。
|
||||
|
||||
以下代码片段在 HPA 清单中使用了不同的指令。请参阅示例下方的列表以了解每个指令的用途。
|
||||
|
||||
```yml
|
||||
apiVersion: autoscaling/v2beta1
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: hello-world
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
name: hello-world
|
||||
minReplicas: 1
|
||||
maxReplicas: 10
|
||||
metrics:
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
targetAverageUtilization: 50
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
targetAverageValue: 100Mi
|
||||
```
|
||||
|
||||
|
||||
| 指令 | 描述 |
|
||||
---------|----------|
|
||||
| `apiVersion: autoscaling/v2beta1` | 正在使用的 Kubernetes `autoscaling` API 组的版本。此示例清单使用 beta 版本,因此启用了按 CPU./内存进行扩缩。 |
|
||||
| `name: hello-world` | 表示 HPA 在为 `hello-word` deployment 执行自动扩缩。 |
|
||||
| `minReplicas: 1` | 表示运行的最小副本数不能低于 1。 |
|
||||
| `maxReplicas: 10` | 指示 deployment 中的最大副本数不能超过 10。 |
|
||||
| `targetAverageUtilization: 50` | 表示当平均运行的 pod 使用超过请求 CPU 的 50% 时,deployment 将扩展 pod。 |
|
||||
| `targetAverageValue: 100Mi` | 表示当平均运行的 pod 使用超过 100Mi 的内存时,deployment 将扩展 pod。 |
|
||||
<br/>
|
||||
|
||||
## 使用资源指标(CPU 和内存)配置 HPA 以进行扩缩
|
||||
|
||||
在 Rancher 2.0.7 及更高版本中创建的集群满足使用 Horizontal Pod Autoscaler 的所有要求(metrics-server 和 Kubernetes 集群配置)。
|
||||
|
||||
运行以下命令以检查你的安装中是否有可用的指标:
|
||||
|
||||
```
|
||||
$ kubectl top nodes
|
||||
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%
|
||||
node-controlplane 196m 9% 1623Mi 42%
|
||||
node-etcd 80m 4% 1090Mi 28%
|
||||
node-worker 64m 3% 1146Mi 29%
|
||||
$ kubectl -n kube-system top pods
|
||||
NAME CPU(cores) MEMORY(bytes)
|
||||
canal-pgldr 18m 46Mi
|
||||
canal-vhkgr 20m 45Mi
|
||||
canal-x5q5v 17m 37Mi
|
||||
canal-xknnz 20m 37Mi
|
||||
kube-dns-7588d5b5f5-298j2 0m 22Mi
|
||||
kube-dns-autoscaler-5db9bbb766-t24hw 0m 5Mi
|
||||
metrics-server-97bc649d5-jxrlt 0m 12Mi
|
||||
$ kubectl -n kube-system logs -l k8s-app=metrics-server
|
||||
I1002 12:55:32.172841 1 heapster.go:71] /metrics-server --source=kubernetes.summary_api:https://kubernetes.default.svc?kubeletHttps=true&kubeletPort=10250&useServiceAccount=true&insecure=true
|
||||
I1002 12:55:32.172994 1 heapster.go:72] Metrics Server version v0.2.1
|
||||
I1002 12:55:32.173378 1 configs.go:61] Using Kubernetes client with master "https://kubernetes.default.svc" and version
|
||||
I1002 12:55:32.173401 1 configs.go:62] Using kubelet port 10250
|
||||
I1002 12:55:32.173946 1 heapster.go:128] Starting with Metric Sink
|
||||
I1002 12:55:32.592703 1 serving.go:308] Generated self-signed cert (apiserver.local.config/certificates/apiserver.crt, apiserver.local.config/certificates/apiserver.key)
|
||||
I1002 12:55:32.925630 1 heapster.go:101] Starting Heapster API server...
|
||||
[restful] 2018/10/02 12:55:32 log.go:33: [restful/swagger] listing is available at https:///swaggerapi
|
||||
[restful] 2018/10/02 12:55:32 log.go:33: [restful/swagger] https:///swaggerui/ is mapped to folder /swagger-ui/
|
||||
I1002 12:55:32.928597 1 serve.go:85] Serving securely on 0.0.0.0:443
|
||||
```
|
||||
|
||||
|
||||
## 配置 HPA 以使用 Prometheus 自定义指标进行扩缩
|
||||
|
||||
你可以将 HPA 配置为根据第三方软件提供的自定义指标进行自动扩缩。使用第三方软件进行自动扩缩的最常见用例是使用应用程序级别的指标(即每秒 HTTP 请求数)。HPA 使用 `custom.metrics.k8s.io` API 来使用这些指标。通过为指标收集解决方案部署自定义指标适配器,你可以启用此 API。
|
||||
|
||||
对于这个例子,我们将使用 [Prometheus](https://prometheus.io/)。我们假设:
|
||||
|
||||
- Prometheus 部署在集群中。
|
||||
- Prometheus 配置正确,并从 pod、节点、命名空间等收集合适的指标。
|
||||
- Prometheus 暴露在以下 URL 和端口:`http://prometheus.mycompany.io:80`
|
||||
|
||||
Prometheus 可用于 Rancher 2.0 应用商店中的 Deployment。如果它还没有运行在你的集群中,请在 Rancher 应用商店中部署它。
|
||||
|
||||
为了让 HPA 使用来自 Prometheus 的自定义指标,[k8s-prometheus-adapter](https://github.com/DirectXMan12/k8s-prometheus-adapter) 包需要在你集群的 `kube-system` 命名空间中。要安装 `k8s-prometheus-adapter`,使用 [banzai-charts](https://github.com/banzaicloud/banzai-charts) 提供的 Helm Chart。
|
||||
|
||||
1. 在集群中初始化 Helm。
|
||||
```
|
||||
# kubectl -n kube-system create serviceaccount tiller
|
||||
kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller
|
||||
helm init --service-account tiller
|
||||
```
|
||||
|
||||
1. 从 GitHub 克隆 `banzai-charts` 仓库:
|
||||
```
|
||||
# git clone https://github.com/banzaicloud/banzai-charts
|
||||
```
|
||||
|
||||
1. 安装 `prometheus-adapter` Chart,指定 Prometheus URL 和端口号:
|
||||
```
|
||||
# helm install --name prometheus-adapter banzai-charts/prometheus-adapter --set prometheus.url="http://prometheus.mycompany.io",prometheus.port="80" --namespace kube-system
|
||||
```
|
||||
|
||||
1. 检查 `prometheus-adapter` 是否正常运行。检查服务 pod 并在 `kube-system` 命名空间中登录。
|
||||
|
||||
1. 检查服务 pod 是否处于 `Running` 状态。输入以下命令:
|
||||
```
|
||||
# kubectl get pods -n kube-system
|
||||
```
|
||||
在输出结果中查找 `Running` 状态。
|
||||
```
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
...
|
||||
prometheus-adapter-prometheus-adapter-568674d97f-hbzfx 1/1 Running 0 7h
|
||||
...
|
||||
```
|
||||
1. 通过输入以下命令检查服务日志,确保服务正常运行:
|
||||
```
|
||||
# kubectl logs prometheus-adapter-prometheus-adapter-568674d97f-hbzfx -n kube-system
|
||||
```
|
||||
然后查看日志输出以确认服务正在运行。
|
||||
|
||||
<details id="prometheus-logs">
|
||||
<summary>Prometheus Adaptor 日志</summary>
|
||||
|
||||
...
|
||||
I0724 10:18:45.696679 1 round_trippers.go:436] GET https://10.43.0.1:443/api/v1/namespaces/default/pods?labelSelector=app%3Dhello-world 200 OK in 2 milliseconds
|
||||
I0724 10:18:45.696695 1 round_trippers.go:442] Response Headers:
|
||||
I0724 10:18:45.696699 1 round_trippers.go:445] Date: Tue, 24 Jul 2018 10:18:45 GMT
|
||||
I0724 10:18:45.696703 1 round_trippers.go:445] Content-Type: application/json
|
||||
I0724 10:18:45.696706 1 round_trippers.go:445] Content-Length: 2581
|
||||
I0724 10:18:45.696766 1 request.go:836] Response Body: {"kind":"PodList","apiVersion":"v1","metadata":{"selfLink":"/api/v1/namespaces/default/pods","resourceVersion":"6237"},"items":[{"metadata":{"name":"hello-world-54764dfbf8-q6l82","generateName":"hello-world-54764dfbf8-","namespace":"default","selfLink":"/api/v1/namespaces/default/pods/hello-world-54764dfbf8-q6l82","uid":"484cb929-8f29-11e8-99d2-067cac34e79c","resourceVersion":"4066","creationTimestamp":"2018-07-24T10:06:50Z","labels":{"app":"hello-world","pod-template-hash":"1032089694"},"annotations":{"cni.projectcalico.org/podIP":"10.42.0.7/32"},"ownerReferences":[{"apiVersion":"extensions/v1beta1","kind":"ReplicaSet","name":"hello-world-54764dfbf8","uid":"4849b9b1-8f29-11e8-99d2-067cac34e79c","controller":true,"blockOwnerDeletion":true}]},"spec":{"volumes":[{"name":"default-token-ncvts","secret":{"secretName":"default-token-ncvts","defaultMode":420}}],"containers":[{"name":"hello-world","image":"rancher/hello-world","ports":[{"containerPort":80,"protocol":"TCP"}],"resources":{"requests":{"cpu":"500m","memory":"64Mi"}},"volumeMounts":[{"name":"default-token-ncvts","readOnly":true,"mountPath":"/var/run/secrets/kubernetes.io/serviceaccount"}],"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"Always"}],"restartPolicy":"Always","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","serviceAccountName":"default","serviceAccount":"default","nodeName":"34.220.18.140","securityContext":{},"schedulerName":"default-scheduler","tolerations":[{"key":"node.kubernetes.io/not-ready","operator":"Exists","effect":"NoExecute","tolerationSeconds":300},{"key":"node.kubernetes.io/unreachable","operator":"Exists","effect":"NoExecute","tolerationSeconds":300}]},"status":{"phase":"Running","conditions":[{"type":"Initialized","status":"True","lastProbeTime":null,"lastTransitionTime":"2018-07-24T10:06:50Z"},{"type":"Ready","status":"True","lastProbeTime":null,"lastTransitionTime":"2018-07-24T10:06:54Z"},{"type":"PodScheduled","status":"True","lastProbeTime":null,"lastTransitionTime":"2018-07-24T10:06:50Z"}],"hostIP":"34.220.18.140","podIP":"10.42.0.7","startTime":"2018-07-24T10:06:50Z","containerStatuses":[{"name":"hello-world","state":{"running":{"startedAt":"2018-07-24T10:06:54Z"}},"lastState":{},"ready":true,"restartCount":0,"image":"rancher/hello-world:latest","imageID":"docker-pullable://rancher/hello-world@sha256:4b1559cb4b57ca36fa2b313a3c7dde774801aa3a2047930d94e11a45168bc053","containerID":"docker://cce4df5fc0408f03d4adf82c90de222f64c302bf7a04be1c82d584ec31530773"}],"qosClass":"Burstable"}}]}
|
||||
I0724 10:18:45.699525 1 api.go:74] GET http://prometheus-server.prometheus.34.220.18.140.xip.io/api/v1/query?query=sum%28rate%28container_fs_read_seconds_total%7Bpod_name%3D%22hello-world-54764dfbf8-q6l82%22%2Ccontainer_name%21%3D%22POD%22%2Cnamespace%3D%22default%22%7D%5B5m%5D%29%29+by+%28pod_name%29&time=1532427525.697 200 OK
|
||||
I0724 10:18:45.699620 1 api.go:93] Response Body: {"status":"success","data":{"resultType":"vector","result":[{"metric":{"pod_name":"hello-world-54764dfbf8-q6l82"},"value":[1532427525.697,"0"]}]}}
|
||||
I0724 10:18:45.699939 1 wrap.go:42] GET /apis/custom.metrics.k8s.io/v1beta1/namespaces/default/pods/%2A/fs_read?labelSelector=app%3Dhello-world: (12.431262ms) 200 [[kube-controller-manager/v1.10.1 (linux/amd64) kubernetes/d4ab475/system:serviceaccount:kube-system:horizontal-pod-autoscaler] 10.42.0.0:24268]
|
||||
I0724 10:18:51.727845 1 request.go:836] Request Body: {"kind":"SubjectAccessReview","apiVersion":"authorization.k8s.io/v1beta1","metadata":{"creationTimestamp":null},"spec":{"nonResourceAttributes":{"path":"/","verb":"get"},"user":"system:anonymous","group":["system:unauthenticated"]},"status":{"allowed":false}}
|
||||
...
|
||||
</details>
|
||||
|
||||
|
||||
|
||||
1. 检查是否可以从 kubectl 访问 metrics API。
|
||||
|
||||
- 如果你直接访问集群,请在 kubectl 配置中输入你的服务器 URL,格式是 `https://<Kubernetes_URL>:6443`:
|
||||
```
|
||||
# kubectl get --raw /apis/custom.metrics.k8s.io/v1beta1
|
||||
```
|
||||
如果 API 可访问,你应该会看到类似以下内容的输出:
|
||||
|
||||
<details id="custom-metrics-api-response">
|
||||
<summary>API 响应</summary>
|
||||
|
||||
{"kind":"APIResourceList","apiVersion":"v1","groupVersion":"custom.metrics.k8s.io/v1beta1","resources":[{"name":"pods/fs_usage_bytes","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/memory_rss","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/spec_cpu_period","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/cpu_cfs_throttled","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_io_time","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_read","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_sector_writes","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/cpu_user","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/last_seen","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/tasks_state","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/spec_cpu_quota","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/start_time_seconds","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_limit_bytes","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_write","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/memory_cache","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/memory_usage_bytes","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/cpu_cfs_periods","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/cpu_cfs_throttled_periods","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_reads_merged","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/memory_working_set_bytes","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/network_udp_usage","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_inodes_free","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_inodes","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_io_time_weighted","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/memory_failures","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/memory_swap","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/spec_cpu_shares","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/spec_memory_swap_limit_bytes","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/cpu_usage","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_io_current","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_writes","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/memory_failcnt","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_reads","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_writes_bytes","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_writes_merged","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/network_tcp_usage","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/memory_max_usage_bytes","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/spec_memory_limit_bytes","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/spec_memory_reservation_limit_bytes","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/cpu_load_average_10s","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/cpu_system","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_reads_bytes","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_sector_reads","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]}]}
|
||||
</details>
|
||||
|
||||
- 如果你通过 Rancher 访问集群,请在 kubectl 配置中输入你的服务器 URL,格式是 `https://<RANCHER_URL>/k8s/clusters/<CLUSTER_ID>`。将 `/k8s/clusters/<CLUSTER_ID>` 后缀添加到 API 路径:
|
||||
```
|
||||
# kubectl get --raw /k8s/clusters/<CLUSTER_ID>/apis/custom.metrics.k8s.io/v1beta1
|
||||
```
|
||||
如果 API 可访问,你应该会看到类似以下内容的输出:
|
||||
|
||||
<details id="custom-metrics-api-response-rancher">
|
||||
<summary>API 响应</summary>
|
||||
|
||||
{"kind":"APIResourceList","apiVersion":"v1","groupVersion":"custom.metrics.k8s.io/v1beta1","resources":[{"name":"pods/fs_usage_bytes","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/memory_rss","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/spec_cpu_period","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/cpu_cfs_throttled","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_io_time","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_read","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_sector_writes","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/cpu_user","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/last_seen","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/tasks_state","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/spec_cpu_quota","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/start_time_seconds","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_limit_bytes","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_write","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/memory_cache","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/memory_usage_bytes","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/cpu_cfs_periods","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/cpu_cfs_throttled_periods","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_reads_merged","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/memory_working_set_bytes","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/network_udp_usage","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_inodes_free","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_inodes","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_io_time_weighted","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/memory_failures","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/memory_swap","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/spec_cpu_shares","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/spec_memory_swap_limit_bytes","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/cpu_usage","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_io_current","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_writes","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/memory_failcnt","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_reads","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_writes_bytes","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_writes_merged","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/network_tcp_usage","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/memory_max_usage_bytes","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/spec_memory_limit_bytes","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/spec_memory_reservation_limit_bytes","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/cpu_load_average_10s","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/cpu_system","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_reads_bytes","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]},{"name":"pods/fs_sector_reads","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]}]}
|
||||
</details>
|
||||
|
||||
+52
-1
@@ -1 +1,52 @@
|
||||
<!-- PLACEHOLDER -->
|
||||
---
|
||||
title: 使用 Rancher UI 管理 HPA
|
||||
weight: 3028
|
||||
---
|
||||
|
||||
Rancher UI 支持创建、管理和删除 HPA。你可以将 CPU 或内存使用情况配置为用于 HPA 扩缩的指标。
|
||||
|
||||
如果你想使用 CPU/内存之外的其他指标创建 HPA,请参阅[配置 HPA 以使用 Prometheus 的自定义指标进行扩缩](./manage-hpas-with-kubectl.md#配置-hpa-以使用-prometheus-自定义指标进行扩缩)。
|
||||
|
||||
## 创建 HPA
|
||||
|
||||
1. 在左上角,单击 **☰ > 集群管理**。
|
||||
1. 转到要创建 HPA 的集群,然后单击 **Explore**。
|
||||
1. 在左侧导航栏中,单击**服务发现 > HorizontalPodAutoscalers**。
|
||||
1. 单击**创建**。
|
||||
1. 为 HPA 选择 **命名空间**。
|
||||
1. 输入 HPA 的**名称**。
|
||||
1. 选择**目标引用**作为 HPA 的扩缩目标。
|
||||
1. 为 HPA 指定**最小副本数**和**最大副本数**。
|
||||
1. 配置 HPA 的指标。你可以将内存或 CPU 使用率作为让 HPA 扩缩服务的指标。在**数量**字段中,输入让 HPA 扩缩服务的工作负载内存/CPU 使用率的百分比。要配置其他 HPA 指标,包括 Prometheus 提供的指标,你需要[使用 kubectl 管理 HPA](./manage-hpas-with-kubectl.md#配置-hpa-以使用-prometheus-自定义指标进行扩缩)。
|
||||
|
||||
1. 单击**创建**以创建HPA。
|
||||
|
||||
:::note 结果:
|
||||
|
||||
HPA 已被部署到选定的命名空间。你可以在项目的**资源 > HPA** 视图中查看 HPA 的状态。
|
||||
|
||||
:::
|
||||
|
||||
## 获取 HPA 指标和状态
|
||||
|
||||
1. 在左上角,单击 **☰ > 集群管理**。
|
||||
1. 转到具有 HPA 的集群并单击 **Explore**。
|
||||
1. 在左侧导航栏中,单击**服务发现 > HorizontalPodAutoscalers**。**HorizontalPodAutoscalers** 页面显示当前副本的数量。
|
||||
|
||||
有关特定 HPA 的更详细指标和状态,请单击 HPA 的名称。你会转到 HPA 的详情页面。
|
||||
|
||||
|
||||
## 删除 HPA
|
||||
|
||||
1. 在左上角,单击 **☰ > 集群管理**。
|
||||
1. 转到要删除的 HPA 的集群,然后单击 **Explore**。
|
||||
1. 在左侧导航栏中,单击**服务发现 > HorizontalPodAutoscalers**。
|
||||
1. 单击**资源 > HPA**。
|
||||
1. 找到要删除的 HPA,然后单击 **⋮ > 删除**。
|
||||
1. 单击**删除**以进行确认。
|
||||
|
||||
:::note 结果:
|
||||
|
||||
HPA 已从当前集群中删除。
|
||||
|
||||
:::
|
||||
+532
-1
@@ -1 +1,532 @@
|
||||
<!-- PLACEHOLDER -->
|
||||
---
|
||||
title: 使用 kubectl 测试 HPA
|
||||
weight: 3031
|
||||
---
|
||||
|
||||
本文介绍如何在使用负载测试工具扩缩 HPA 后检查 HPA 的状态。有关使用 Rancher UI(最低版本 2.3.x)检查状态的信息,请参阅[使用 Rancher UI 管理 HPA](./manage-hpas-with-kubectl.md)。
|
||||
|
||||
要让 HPA 正常工作,服务部署应该具有容器的资源请求定义。按照以下 hello-world 示例测试 HPA 是否正常工作。
|
||||
|
||||
1. 将 `kubectl` 连接到你的 Kubernetes 集群。
|
||||
|
||||
1. 复制下方的 `hello-world` 部署清单。
|
||||
|
||||
<details id="hello-world">
|
||||
<summary>Hello World 清单</summary>
|
||||
|
||||
```
|
||||
apiVersion: apps/v1beta2
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
app: hello-world
|
||||
name: hello-world
|
||||
namespace: default
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: hello-world
|
||||
strategy:
|
||||
rollingUpdate:
|
||||
maxSurge: 1
|
||||
maxUnavailable: 0
|
||||
type: RollingUpdate
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: hello-world
|
||||
spec:
|
||||
containers:
|
||||
- image: rancher/hello-world
|
||||
imagePullPolicy: Always
|
||||
name: hello-world
|
||||
resources:
|
||||
requests:
|
||||
cpu: 500m
|
||||
memory: 64Mi
|
||||
ports:
|
||||
- containerPort: 80
|
||||
protocol: TCP
|
||||
restartPolicy: Always
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: hello-world
|
||||
namespace: default
|
||||
spec:
|
||||
ports:
|
||||
- port: 80
|
||||
protocol: TCP
|
||||
targetPort: 80
|
||||
selector:
|
||||
app: hello-world
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
1. 将其部署到你的集群。
|
||||
|
||||
```
|
||||
# kubectl create -f <HELLO_WORLD_MANIFEST>
|
||||
```
|
||||
|
||||
1. 根据你使用的指标类型复制以下其中一个 HPA:
|
||||
|
||||
<details id="service-deployment-resource-metrics">
|
||||
<summary>Hello World HPA:资源指标</summary>
|
||||
|
||||
```
|
||||
apiVersion: autoscaling/v2beta1
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: hello-world
|
||||
namespace: default
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
name: hello-world
|
||||
minReplicas: 1
|
||||
maxReplicas: 10
|
||||
metrics:
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
targetAverageUtilization: 50
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
targetAverageValue: 1000Mi
|
||||
```
|
||||
|
||||
</details>
|
||||
<details id="service-deployment-custom-metrics">
|
||||
<summary>Hello World HPA:自定义指标</summary>
|
||||
|
||||
```
|
||||
apiVersion: autoscaling/v2beta1
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: hello-world
|
||||
namespace: default
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
name: hello-world
|
||||
minReplicas: 1
|
||||
maxReplicas: 10
|
||||
metrics:
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
targetAverageUtilization: 50
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
targetAverageValue: 100Mi
|
||||
- type: Pods
|
||||
pods:
|
||||
metricName: cpu_system
|
||||
targetAverageValue: 20m
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
1. 查看 HPA 信息和描述。确认显示的指标数据。
|
||||
|
||||
<details id="hpa-info-resource-metrics">
|
||||
<summary>资源指标</summary>
|
||||
|
||||
1. 输入以下命令:
|
||||
```
|
||||
# kubectl get hpa
|
||||
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
|
||||
hello-world Deployment/hello-world 1253376 / 100Mi, 0% / 50% 1 10 1 6m
|
||||
# kubectl describe hpa
|
||||
Name: hello-world
|
||||
Namespace: default
|
||||
Labels: <none>
|
||||
Annotations: <none>
|
||||
CreationTimestamp: Mon, 23 Jul 2018 20:21:16 +0200
|
||||
Reference: Deployment/hello-world
|
||||
Metrics: ( current / target )
|
||||
resource memory on pods: 1253376 / 100Mi
|
||||
resource cpu on pods (as a percentage of request): 0% (0) / 50%
|
||||
Min replicas: 1
|
||||
Max replicas: 10
|
||||
Conditions:
|
||||
Type Status Reason Message
|
||||
---- ------ ------ -------
|
||||
AbleToScale True ReadyForNewScale the last scale time was sufficiently old as to warrant a new scale
|
||||
ScalingActive True ValidMetricFound the HPA was able to successfully calculate a replica count from memory resource
|
||||
ScalingLimited False DesiredWithinRange the desired count is within the acceptable range
|
||||
Events: <none>
|
||||
```
|
||||
|
||||
</details>
|
||||
<details id="hpa-info-custom-metrics">
|
||||
<summary>自定义指标</summary>
|
||||
|
||||
1. 输入以下命令:
|
||||
```
|
||||
# kubectl describe hpa
|
||||
```
|
||||
You should receive the output that follows.
|
||||
```
|
||||
Name: hello-world
|
||||
Namespace: default
|
||||
Labels: <none>
|
||||
Annotations: <none>
|
||||
CreationTimestamp: Tue, 24 Jul 2018 18:36:28 +0200
|
||||
Reference: Deployment/hello-world
|
||||
Metrics: ( current / target )
|
||||
resource memory on pods: 3514368 / 100Mi
|
||||
"cpu_system" on pods: 0 / 20m
|
||||
resource cpu on pods (as a percentage of request): 0% (0) / 50%
|
||||
Min replicas: 1
|
||||
Max replicas: 10
|
||||
Conditions:
|
||||
Type Status Reason Message
|
||||
---- ------ ------ -------
|
||||
AbleToScale True ReadyForNewScale the last scale time was sufficiently old as to warrant a new scale
|
||||
ScalingActive True ValidMetricFound the HPA was able to successfully calculate a replica count from memory resource
|
||||
ScalingLimited False DesiredWithinRange the desired count is within the acceptable range
|
||||
Events: <none>
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
1. 为服务生成负载,从而测试你的 pod 是否按预期进行了自动扩缩。你可以使用任何负载测试工具(Hey、Gatling 等),我们使用的是 [Hey](https://github.com/rakyll/hey)。
|
||||
|
||||
1. 测试 pod 自动扩缩是否按预期工作。<br/><br/>
|
||||
**使用资源指标测试自动扩缩:**
|
||||
|
||||
<details id="observe-upscale-2-pods-cpu">
|
||||
<summary>扩展到两个 Pod:CPU 用量达到目标</summary>
|
||||
|
||||
使用你的负载测试工具根据 CPU 使用情况扩展到两个 Pod。
|
||||
|
||||
1. 查看你的 HPA。
|
||||
```
|
||||
# kubectl describe hpa
|
||||
```
|
||||
你应该会看到类似以下的输出:
|
||||
```
|
||||
Name: hello-world
|
||||
Namespace: default
|
||||
Labels: <none>
|
||||
Annotations: <none>
|
||||
CreationTimestamp: Mon, 23 Jul 2018 22:22:04 +0200
|
||||
Reference: Deployment/hello-world
|
||||
Metrics: ( current / target )
|
||||
resource memory on pods: 10928128 / 100Mi
|
||||
resource cpu on pods (as a percentage of request): 56% (280m) / 50%
|
||||
Min replicas: 1
|
||||
Max replicas: 10
|
||||
Conditions:
|
||||
Type Status Reason Message
|
||||
---- ------ ------ -------
|
||||
AbleToScale True SucceededRescale the HPA controller was able to update the target scale to 2
|
||||
ScalingActive True ValidMetricFound the HPA was able to successfully calculate a replica count from cpu resource utilization (percentage of request)
|
||||
ScalingLimited False DesiredWithinRange the desired count is within the acceptable range
|
||||
Events:
|
||||
Type Reason Age From Message
|
||||
---- ------ ---- ---- -------
|
||||
Normal SuccessfulRescale 13s horizontal-pod-autoscaler New size: 2; reason: cpu resource utilization (percentage of request) above target
|
||||
```
|
||||
1. 输入以下命令,确认你已扩展到两个 pod:
|
||||
```
|
||||
# kubectl get pods
|
||||
```
|
||||
你应该会看到类似以下的输出:
|
||||
```
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
hello-world-54764dfbf8-k8ph2 1/1 Running 0 1m
|
||||
hello-world-54764dfbf8-q6l4v 1/1 Running 0 3h
|
||||
```
|
||||
|
||||
</details>
|
||||
<details id="observe-upscale-3-pods-cpu-cooldown">
|
||||
<summary>扩展到三个 Pod:CPU 用量达到目标</summary>
|
||||
|
||||
使用你的负载测试工具根据 CPU 用量扩展到三个 Pod,并将 `horizontal-pod-autoscaler-upscale-delay` 设置为 3 分钟。
|
||||
|
||||
1. 输入以下命令:
|
||||
```
|
||||
# kubectl describe hpa
|
||||
```
|
||||
你应该会看到类似以下的输出:
|
||||
```
|
||||
Name: hello-world
|
||||
Namespace: default
|
||||
Labels: <none>
|
||||
Annotations: <none>
|
||||
CreationTimestamp: Mon, 23 Jul 2018 22:22:04 +0200
|
||||
Reference: Deployment/hello-world
|
||||
Metrics: ( current / target )
|
||||
resource memory on pods: 9424896 / 100Mi
|
||||
resource cpu on pods (as a percentage of request): 66% (333m) / 50%
|
||||
Min replicas: 1
|
||||
Max replicas: 10
|
||||
Conditions:
|
||||
Type Status Reason Message
|
||||
---- ------ ------ -------
|
||||
AbleToScale True SucceededRescale the HPA controller was able to update the target scale to 3
|
||||
ScalingActive True ValidMetricFound the HPA was able to successfully calculate a replica count from cpu resource utilization (percentage of request)
|
||||
ScalingLimited False DesiredWithinRange the desired count is within the acceptable range
|
||||
Events:
|
||||
Type Reason Age From Message
|
||||
---- ------ ---- ---- -------
|
||||
Normal SuccessfulRescale 4m horizontal-pod-autoscaler New size: 2; reason: cpu resource utilization (percentage of request) above target
|
||||
Normal SuccessfulRescale 16s horizontal-pod-autoscaler New size: 3; reason: cpu resource utilization (percentage of request) above target
|
||||
```
|
||||
2. 输入以下命令,确认三个 pod 正在运行:
|
||||
```
|
||||
# kubectl get pods
|
||||
```
|
||||
你应该会看到类似以下的输出:
|
||||
```
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
hello-world-54764dfbf8-f46kh 0/1 Running 0 1m
|
||||
hello-world-54764dfbf8-k8ph2 1/1 Running 0 5m
|
||||
hello-world-54764dfbf8-q6l4v 1/1 Running 0 3h
|
||||
```
|
||||
|
||||
</details>
|
||||
<details id="observe-downscale-1-pod">
|
||||
<summary>缩减到 1 个 Pod:所有指标均低于目标</summary>
|
||||
|
||||
当 `horizontal-pod-autoscaler-downscale-delay` 的所有指标均低于目标(默认为 5 分钟)时,使用你的负载测试工具缩减到 1 个 pod。
|
||||
|
||||
1. 输入以下命令:
|
||||
```
|
||||
# kubectl describe hpa
|
||||
```
|
||||
你应该会看到类似以下的输出:
|
||||
```
|
||||
Name: hello-world
|
||||
Namespace: default
|
||||
Labels: <none>
|
||||
Annotations: <none>
|
||||
CreationTimestamp: Mon, 23 Jul 2018 22:22:04 +0200
|
||||
Reference: Deployment/hello-world
|
||||
Metrics: ( current / target )
|
||||
resource memory on pods: 10070016 / 100Mi
|
||||
resource cpu on pods (as a percentage of request): 0% (0) / 50%
|
||||
Min replicas: 1
|
||||
Max replicas: 10
|
||||
Conditions:
|
||||
Type Status Reason Message
|
||||
---- ------ ------ -------
|
||||
AbleToScale True SucceededRescale the HPA controller was able to update the target scale to 1
|
||||
ScalingActive True ValidMetricFound the HPA was able to successfully calculate a replica count from memory resource
|
||||
ScalingLimited False DesiredWithinRange the desired count is within the acceptable range
|
||||
Events:
|
||||
Type Reason Age From Message
|
||||
---- ------ ---- ---- -------
|
||||
Normal SuccessfulRescale 10m horizontal-pod-autoscaler New size: 2; reason: cpu resource utilization (percentage of request) above target
|
||||
Normal SuccessfulRescale 6m horizontal-pod-autoscaler New size: 3; reason: cpu resource utilization (percentage of request) above target
|
||||
Normal SuccessfulRescale 1s horizontal-pod-autoscaler New size: 1; reason: All metrics below target
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
**使用自定义指标测试自动缩放:**
|
||||
|
||||
<details id="custom-observe-upscale-2-pods-cpu">
|
||||
<summary>扩展到两个 Pod:CPU 用量达到目标</summary>
|
||||
|
||||
使用负载测试工具根据 CPU 用量扩展到两个 Pod。
|
||||
|
||||
1. 输入以下命令:
|
||||
```
|
||||
# kubectl describe hpa
|
||||
```
|
||||
你应该会看到类似以下的输出:
|
||||
```
|
||||
Name: hello-world
|
||||
Namespace: default
|
||||
Labels: <none>
|
||||
Annotations: <none>
|
||||
CreationTimestamp: Tue, 24 Jul 2018 18:01:11 +0200
|
||||
Reference: Deployment/hello-world
|
||||
Metrics: ( current / target )
|
||||
resource memory on pods: 8159232 / 100Mi
|
||||
"cpu_system" on pods: 7m / 20m
|
||||
resource cpu on pods (as a percentage of request): 64% (321m) / 50%
|
||||
Min replicas: 1
|
||||
Max replicas: 10
|
||||
Conditions:
|
||||
Type Status Reason Message
|
||||
---- ------ ------ -------
|
||||
AbleToScale True SucceededRescale the HPA controller was able to update the target scale to 2
|
||||
ScalingActive True ValidMetricFound the HPA was able to successfully calculate a replica count from cpu resource utilization (percentage of request)
|
||||
ScalingLimited False DesiredWithinRange the desired count is within the acceptable range
|
||||
Events:
|
||||
Type Reason Age From Message
|
||||
---- ------ ---- ---- -------
|
||||
Normal SuccessfulRescale 16s horizontal-pod-autoscaler New size: 2; reason: cpu resource utilization (percentage of request) above target
|
||||
```
|
||||
1. 输入以下命令,确认两个 pod 正在运行:
|
||||
```
|
||||
# kubectl get pods
|
||||
```
|
||||
你应该会看到类似以下的输出:
|
||||
```
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
hello-world-54764dfbf8-5pfdr 1/1 Running 0 3s
|
||||
hello-world-54764dfbf8-q6l82 1/1 Running 0 6h
|
||||
```
|
||||
|
||||
</details>
|
||||
<details id="observe-upscale-3-pods-cpu-cooldown-2">
|
||||
<summary>扩展到三个 Pod:CPU 用量达到目标</summary>
|
||||
|
||||
当 cpu_system 用量达到目标时,使用你的负载测试工具扩展到三个 Pod。
|
||||
|
||||
1. 输入以下命令:
|
||||
```
|
||||
# kubectl describe hpa
|
||||
```
|
||||
你应该会看到类似以下的输出:
|
||||
```
|
||||
Name: hello-world
|
||||
Namespace: default
|
||||
Labels: <none>
|
||||
Annotations: <none>
|
||||
CreationTimestamp: Tue, 24 Jul 2018 18:01:11 +0200
|
||||
Reference: Deployment/hello-world
|
||||
Metrics: ( current / target )
|
||||
resource memory on pods: 8374272 / 100Mi
|
||||
"cpu_system" on pods: 27m / 20m
|
||||
resource cpu on pods (as a percentage of request): 71% (357m) / 50%
|
||||
Min replicas: 1
|
||||
Max replicas: 10
|
||||
Conditions:
|
||||
Type Status Reason Message
|
||||
---- ------ ------ -------
|
||||
AbleToScale True SucceededRescale the HPA controller was able to update the target scale to 3
|
||||
ScalingActive True ValidMetricFound the HPA was able to successfully calculate a replica count from cpu resource utilization (percentage of request)
|
||||
ScalingLimited False DesiredWithinRange the desired count is within the acceptable range
|
||||
Events:
|
||||
Type Reason Age From Message
|
||||
---- ------ ---- ---- -------
|
||||
Normal SuccessfulRescale 3m horizontal-pod-autoscaler New size: 2; reason: cpu resource utilization (percentage of request) above target
|
||||
Normal SuccessfulRescale 3s horizontal-pod-autoscaler New size: 3; reason: pods metric cpu_system above target
|
||||
```
|
||||
1. 输入以下命令,确认三个 pod 正在运行:
|
||||
```
|
||||
# kubectl get pods
|
||||
```
|
||||
你应该会看到类似以下的输出:
|
||||
```
|
||||
# kubectl get pods
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
hello-world-54764dfbf8-5pfdr 1/1 Running 0 3m
|
||||
hello-world-54764dfbf8-m2hrl 1/1 Running 0 1s
|
||||
hello-world-54764dfbf8-q6l82 1/1 Running 0 6h
|
||||
```
|
||||
|
||||
</details>
|
||||
<details id="observe-upscale-4-pods">
|
||||
<summary>扩展到四个 Pod:CPU 用量达到目标</summary>
|
||||
|
||||
使用负载测试工具根据 CPU 用量扩展到四个 Pod。`horizontal-pod-autoscaler-upscale-delay` 默认设置为 3 分钟。
|
||||
|
||||
1. 输入以下命令:
|
||||
```
|
||||
# kubectl describe hpa
|
||||
```
|
||||
你应该会看到类似以下的输出:
|
||||
```
|
||||
Name: hello-world
|
||||
Namespace: default
|
||||
Labels: <none>
|
||||
Annotations: <none>
|
||||
CreationTimestamp: Tue, 24 Jul 2018 18:01:11 +0200
|
||||
Reference: Deployment/hello-world
|
||||
Metrics: ( current / target )
|
||||
resource memory on pods: 8374272 / 100Mi
|
||||
"cpu_system" on pods: 27m / 20m
|
||||
resource cpu on pods (as a percentage of request): 71% (357m) / 50%
|
||||
Min replicas: 1
|
||||
Max replicas: 10
|
||||
Conditions:
|
||||
Type Status Reason Message
|
||||
---- ------ ------ -------
|
||||
AbleToScale True SucceededRescale the HPA controller was able to update the target scale to 3
|
||||
ScalingActive True ValidMetricFound the HPA was able to successfully calculate a replica count from cpu resource utilization (percentage of request)
|
||||
ScalingLimited False DesiredWithinRange the desired count is within the acceptable range
|
||||
Events:
|
||||
Type Reason Age From Message
|
||||
---- ------ ---- ---- -------
|
||||
Normal SuccessfulRescale 5m horizontal-pod-autoscaler New size: 2; reason: cpu resource utilization (percentage of request) above target
|
||||
Normal SuccessfulRescale 3m horizontal-pod-autoscaler New size: 3; reason: pods metric cpu_system above target
|
||||
Normal SuccessfulRescale 4s horizontal-pod-autoscaler New size: 4; reason: cpu resource utilization (percentage of request) above target
|
||||
```
|
||||
|
||||
1. 输入以下命令,确认四个 pod 正在运行:
|
||||
```
|
||||
# kubectl get pods
|
||||
```
|
||||
你应该会看到类似以下的输出:
|
||||
```
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
hello-world-54764dfbf8-2p9xb 1/1 Running 0 5m
|
||||
hello-world-54764dfbf8-5pfdr 1/1 Running 0 2m
|
||||
hello-world-54764dfbf8-m2hrl 1/1 Running 0 1s
|
||||
hello-world-54764dfbf8-q6l82 1/1 Running 0 6h
|
||||
```
|
||||
|
||||
</details>
|
||||
<details id="custom-metrics-observe-downscale-1-pod">
|
||||
<summary>缩减到 1 个 Pod:所有指标均低于目标</summary>
|
||||
|
||||
当 `horizontal-pod-autoscaler-downscale-delay` 的所有指标均低于目标时,使用你的负载测试工具缩减到 1 个 pod。
|
||||
|
||||
1. 输入以下命令:
|
||||
```
|
||||
# kubectl describe hpa
|
||||
```
|
||||
你应该会看到类似以下的输出:
|
||||
```
|
||||
Name: hello-world
|
||||
Namespace: default
|
||||
Labels: <none>
|
||||
Annotations: <none>
|
||||
CreationTimestamp: Tue, 24 Jul 2018 18:01:11 +0200
|
||||
Reference: Deployment/hello-world
|
||||
Metrics: ( current / target )
|
||||
resource memory on pods: 8101888 / 100Mi
|
||||
"cpu_system" on pods: 8m / 20m
|
||||
resource cpu on pods (as a percentage of request): 0% (0) / 50%
|
||||
Min replicas: 1
|
||||
Max replicas: 10
|
||||
Conditions:
|
||||
Type Status Reason Message
|
||||
---- ------ ------ -------
|
||||
AbleToScale True SucceededRescale the HPA controller was able to update the target scale to 1
|
||||
ScalingActive True ValidMetricFound the HPA was able to successfully calculate a replica count from memory resource
|
||||
ScalingLimited False DesiredWithinRange the desired count is within the acceptable range
|
||||
Events:
|
||||
Type Reason Age From Message
|
||||
---- ------ ---- ---- -------
|
||||
Normal SuccessfulRescale 10m horizontal-pod-autoscaler New size: 2; reason: cpu resource utilization (percentage of request) above target
|
||||
Normal SuccessfulRescale 8m horizontal-pod-autoscaler New size: 3; reason: pods metric cpu_system above target
|
||||
Normal SuccessfulRescale 5m horizontal-pod-autoscaler New size: 4; reason: cpu resource utilization (percentage of request) above target
|
||||
Normal SuccessfulRescale 13s horizontal-pod-autoscaler New size: 1; reason: All metrics below target
|
||||
```
|
||||
1. 输入以下命令,确认单个 pod 正在运行:
|
||||
```
|
||||
# kubectl get pods
|
||||
```
|
||||
你应该会看到类似以下的输出:
|
||||
```
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
hello-world-54764dfbf8-q6l82 1/1 Running 0 6h
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ API 有自己的用户界面,你可以从 Web 浏览器访问它。这是查
|
||||
1. 在 **API 密钥**下,找到 **API 端点**字段并单击链接。该链接类似于 `https://<RANCHER_FQDN>/v3`,其中 `<RANCHER_FQDN>` 是 Rancher deployment 的完全限定域名。
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="Rancher before v2.6.4">
|
||||
<TabItem value="Rancher v2.6.4 之前的版本">
|
||||
|
||||
转到位于 `https://<RANCHER_FQDN>/v3` 的 URL 端点,其中 `<RANCHER_FQDN>` 是你的 Rancher deployment 的完全限定域名。
|
||||
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ Rancher 通过 _用户_ 进行授权管理。用户的 _授权_ 或系统访问
|
||||
|
||||
_Pod 安全策略(PSP)_ 是用来控制安全敏感相关 Pod 规范(例如 root 特权)的对象。如果某个 Pod 不满足 PSP 指定的条件,Kubernetes 将不允许它启动,并在 Rancher 中显示错误消息。
|
||||
|
||||
有关如何创建和使用 PSP,请参见[Pod 安全策略](../how-to-guides/advanced-user-guides/authentication-permissions-and-global-configuration/create-pod-security-policies.md)。
|
||||
有关如何创建和使用 PSP,请参见 [Pod 安全策略](../how-to-guides/advanced-user-guides/authentication-permissions-and-global-configuration/create-pod-security-policies.md)。
|
||||
|
||||
## 配置驱动
|
||||
|
||||
|
||||
+1
-1
@@ -16,6 +16,6 @@ weight: 100
|
||||
- [Outscale](../getting-started/quick-start-guides/deploy-rancher-manager/outscale-qs.md)(使用 Terraform)
|
||||
|
||||
|
||||
如有需要,你可以查看以下指南以了解分步步骤。如果你需要在其他提供商中或本地运行 Rancher,或者你只是想看看它是多么容易上手,你可阅读以下指南。
|
||||
如有需要,你可以查看以下指南以了解分步步骤。如果你需要在其他提供商中或本地运行 Rancher,或者你只是想看看它是多么容易上手,你可阅读以下指南:
|
||||
|
||||
- [手动安装](../getting-started/quick-start-guides/deploy-rancher-manager/helm-cli.md)
|
||||
|
||||
+27
-1
@@ -1 +1,27 @@
|
||||
<!-- PLACEHOLDER -->
|
||||
---
|
||||
title: Horizontal Pod Autoscaler
|
||||
description: 了解 Pod 水平自动扩缩 (HPA)。如何管理 HPA 以及如何使用服务部署来进行测试
|
||||
weight: 3026
|
||||
---
|
||||
|
||||
[Horizontal Pod Autoscaler(HPA)](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/)是一项 Kubernetes 功能,用于将集群配置为自动扩缩其运行的服务。
|
||||
|
||||
Rancher 提供了一些附加功能来帮助管理 HPA,具体取决于 Rancher 的版本。
|
||||
|
||||
你可以使用 Rancher UI 创建、管理和删除 HPA。仅在 `autoscaling/v2beta2` API 中支持 HPA。
|
||||
|
||||
## 管理 HPA
|
||||
|
||||
管理 HPA 的方式因你的 Kubernetes API 版本而异:
|
||||
|
||||
- **Kubernetes API 版本 autoscaling/V2beta1**:允许根据应用程序的 CPU 和内存利用率自动扩缩 pod。
|
||||
- **Kubernetes API 版本 autoscaling/V2beta2**:允许根据 CPU 和内存利用率以及自定义指标自动扩缩 pod。
|
||||
|
||||
你可以使用 Rancher UI 创建、管理和删除 HPA。在 Rancher UI 中,你可以将 HPA 配置为根据 CPU 和内存利用率进行扩缩。有关详细信息,请参阅[使用 Rancher UI 管理 HPA](../how-to-guides/new-user-guides/kubernetes-resources-setup/horizontal-pod-autoscaler/manage-hpas-with-ui.md)。如需根据自定义指标进行 HPA,你仍然需要使用 `kubectl`。有关详细信息,请参阅[配置 HPA 以使用 Prometheus 自定义指标进行扩缩](../how-to-guides/new-user-guides/kubernetes-resources-setup/horizontal-pod-autoscaler/manage-hpas-with-kubectl.md#配置-hpa-以使用-prometheus-自定义指标进行扩缩)。
|
||||
|
||||
在 Rancher 2.0.7 及更高版本中创建的集群自动满足使用 HPA 的所有要求(metrics-server 和 Kubernetes 集群配置)。
|
||||
## 使用服务部署测试 HPA
|
||||
|
||||
你可以转到你的项目并单击**资源 > HPA**来查看 HPA 当前的副本数。有关详细信息,请参阅[获取 HPA 指标和状态](../how-to-guides/new-user-guides/kubernetes-resources-setup/horizontal-pod-autoscaler/manage-hpas-with-ui.md)。
|
||||
|
||||
你还可以使用 `kubectl` 来获取你使用负载测试工具测试的 HPA 的状态。有关详细信息,请参阅[使用 kubectl 测试 HPA](../how-to-guides/new-user-guides/kubernetes-resources-setup/horizontal-pod-autoscaler/test-hpas-with-kubectl.md)。
|
||||
|
||||
+18
-4
@@ -88,7 +88,7 @@ Rancher 是使用 Kubernetes 的 [Helm](https://helm.sh/) 包管理器安装的
|
||||
```
|
||||
- Alpha:即将发布的实验性预览。
|
||||
```
|
||||
helm repo add rancher-stable https://releases.rancher.com/server-charts/stable
|
||||
helm repo add rancher-alpha https://releases.rancher.com/server-charts/alpha
|
||||
```
|
||||
注意:不支持升级到 Alpha 版、从 Alpha 版升级或在 Alpha 版之间升级。
|
||||
|
||||
@@ -197,7 +197,6 @@ cert-manager-webhook-787858fcdb-nlzsq 1/1 Running 0 2m
|
||||
|
||||
- 将 `hostname` 设置为解析到你的负载均衡器的 DNS 名称。
|
||||
- 将 `bootstrapPassword` 设置为 `admin` 用户独有的值。
|
||||
- 如果你安装的是 alpha 版本,Helm 要求你在命令中添加 `--devel` 选项。
|
||||
- 如果你需要安装指定的 Rancher 版本,使用 `--version` 标志,例如 `--version 2.3.6`。
|
||||
|
||||
```
|
||||
@@ -207,6 +206,12 @@ helm install rancher rancher-<CHART_REPO>/rancher \
|
||||
--set bootstrapPassword=admin
|
||||
```
|
||||
|
||||
如果你安装的是 alpha 版本,Helm 会要求你在安装命令中添加 `--devel` 选项:
|
||||
|
||||
```
|
||||
helm install rancher rancher-alpha/rancher --devel
|
||||
```
|
||||
|
||||
等待 Rancher 运行:
|
||||
|
||||
```
|
||||
@@ -233,7 +238,6 @@ deployment "rancher" successfully rolled out
|
||||
- 将 `ingress.tls.source` 设置为 `letsEncrypt`。
|
||||
- 将 `letsEncrypt.email` 设置为可通讯的电子邮件地址,用于发送通知(例如证书到期的通知)。
|
||||
- 将 `letsEncrypt.ingress.class` 设为你的 Ingress Controller(例如 `traefik`,`nginx`,`haproxy`)
|
||||
- 如果你安装的是 alpha 版本,Helm 要求你在命令中添加 `--devel` 选项。
|
||||
|
||||
```
|
||||
helm install rancher rancher-<CHART_REPO>/rancher \
|
||||
@@ -245,6 +249,12 @@ helm install rancher rancher-<CHART_REPO>/rancher \
|
||||
--set letsEncrypt.ingress.class=nginx
|
||||
```
|
||||
|
||||
如果你安装的是 alpha 版本,Helm 会要求你在安装命令中添加 `--devel` 选项:
|
||||
|
||||
```
|
||||
helm install rancher rancher-alpha/rancher --devel
|
||||
```
|
||||
|
||||
等待 Rancher 运行:
|
||||
|
||||
```
|
||||
@@ -270,7 +280,6 @@ deployment "rancher" successfully rolled out
|
||||
- 设置 `hostname`。
|
||||
- 将 `bootstrapPassword` 设置为 `admin` 用户独有的值。
|
||||
- 将 `ingress.tls.source` 设置为 `secret`。
|
||||
- 如果你安装的是 alpha 版本,Helm 要求你在命令中添加 `--devel` 选项。
|
||||
|
||||
```
|
||||
helm install rancher rancher-<CHART_REPO>/rancher \
|
||||
@@ -279,6 +288,11 @@ helm install rancher rancher-<CHART_REPO>/rancher \
|
||||
--set bootstrapPassword=admin \
|
||||
--set ingress.tls.source=secret
|
||||
```
|
||||
如果你安装的是 alpha 版本,Helm 会要求你在安装命令中添加 `--devel` 选项:
|
||||
|
||||
```
|
||||
helm install rancher rancher-alpha/rancher --devel
|
||||
```
|
||||
|
||||
如果你使用的是私有 CA 证书,请在命令中增加 `--set privateCA=true`。
|
||||
|
||||
|
||||
@@ -51,13 +51,13 @@ Rancher 的流水线提供简单的 CI/CD 体验,但不提供完整的功能
|
||||
|
||||
- **Jenkins**:
|
||||
|
||||
流水线的构建引擎。由于项目用户不直接与 Jenkins 交互,因此 Jenkins 是被托管和锁定的。
|
||||
流水线的构建引擎。由于项目用户不直接与 Jenkins 交互,因此 Jenkins 是被托管和锁定的。
|
||||
|
||||
:::note
|
||||
:::note
|
||||
|
||||
没有使用现有 Jenkins deployment 作为流水线引擎的选项。
|
||||
没有使用现有 Jenkins deployment 作为流水线引擎的选项。
|
||||
|
||||
:::
|
||||
:::
|
||||
|
||||
- **Docker 镜像仓库**:
|
||||
|
||||
@@ -65,13 +65,13 @@ Rancher 的流水线提供简单的 CI/CD 体验,但不提供完整的功能
|
||||
|
||||
- **Minio**:
|
||||
|
||||
Minio 存储用于存储流水线执行的日志。
|
||||
Minio 存储用于存储流水线执行的日志。
|
||||
|
||||
:::note
|
||||
:::note
|
||||
|
||||
托管的 Jenkins 实例是无状态工作的,因此你不用担心它的数据持久性。Docker 镜像仓库和 Minio 实例默认使用临时卷,这种做法适用于大多数用例。如果你想确保流水线日志能够在节点故障的情况下也能保存,你可以为它们配置持久卷(参见[流水线组件的数据持久性](../reference-guides/pipelines/configure-persistent-data.md))。
|
||||
托管的 Jenkins 实例是无状态工作的,因此你不用担心它的数据持久性。Docker 镜像仓库和 Minio 实例默认使用临时卷,这种做法适用于大多数用例。如果你想确保流水线日志能够在节点故障的情况下也能保存,你可以为它们配置持久卷(参见[流水线组件的数据持久性](../reference-guides/pipelines/configure-persistent-data.md))。
|
||||
|
||||
:::
|
||||
:::
|
||||
|
||||
## 流水线的 RBAC
|
||||
|
||||
|
||||
+3
-3
@@ -55,20 +55,20 @@ weight: 2225
|
||||
|
||||
:::
|
||||
|
||||
6. <a id="step-6"></a>单击**下一步**。
|
||||
6. 点击**下一步**。
|
||||
|
||||
4. 使用**成员角色**为集群配置用户授权。点击**添加成员**添加可以访问集群的用户。使用**角色**下拉菜单为每个用户设置权限。
|
||||
|
||||
7. 从**节点角色**中,选择要由集群节点充当的角色。你必须为 `etcd`、`worker` 和 `controlplane` 角色配置至少一个节点。自定义集群需要所有三个角色才能完成配置。有关角色的详细信息,请参阅[本节](../reference-guides/kubernetes-concepts.md#kubernetes-集群中节点的角色)。
|
||||
|
||||
:::note 注意事项:
|
||||
:::note
|
||||
|
||||
- 使用 Windows 主机作为 Kubernetes Worker 节点?请参阅[本节](use-windows-clusters.md)。
|
||||
- 裸机服务器提醒:如果你想将裸机服务器专用于每个角色,则必须为每个角色配置一个裸机服务器(即配置多个裸机服务器)。
|
||||
|
||||
:::
|
||||
|
||||
8. <a id="step-8"></a>**可选**:点击[显示高级选项](../how-to-guides/new-user-guides/kubernetes-clusters-in-rancher-setup/launch-kubernetes-with-rancher/about-rancher-agents.md)来指定注册节点时使用的 IP 地址,覆盖节点的主机名,或将[标签](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/)或[污点](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/)添加到节点。
|
||||
8. **可选**:点击[显示高级选项](../how-to-guides/new-user-guides/kubernetes-clusters-in-rancher-setup/launch-kubernetes-with-rancher/about-rancher-agents.md)来指定注册节点时使用的 IP 地址,覆盖节点的主机名,或将[标签](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/)或[污点](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/)添加到节点。
|
||||
|
||||
9. 将屏幕上显示的命令复制到剪贴板。
|
||||
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ kubectl create secret generic encryptionconfig \
|
||||
|
||||
这将确保密文包含一个名为 `encryption-provider-config.yaml` 的 key,而且 operator 会使用该 key 来获取加密配置。
|
||||
|
||||
`加密配置密文` 下拉菜单将过滤并仅列出拥有这个 key 的密文。
|
||||
`Encryption Config Secret` 下拉菜单将过滤并仅列出拥有这个 key 的密文。
|
||||
|
||||

|
||||
|
||||
|
||||
+2
-2
@@ -38,13 +38,13 @@ weight: 2
|
||||
|
||||
## 加密
|
||||
|
||||
如果备份是在启用加密的情况下创建的,备份文件的后缀为 `.enc`。如果你选择这类的 Backup,或者提供后缀为 `.enc` 的备份文件名,则会显示另一个名为**加密配置密文**的下拉菜单。
|
||||
如果备份是在启用加密的情况下创建的,备份文件的后缀为 `.enc`。如果你选择这类的 Backup,或者提供后缀为 `.enc` 的备份文件名,则会显示另一个名为 **Encryption Config Secret** 的下拉菜单。
|
||||
|
||||

|
||||
|
||||
从该下拉菜单中选择的密文必须与执行备份时用于 Backup 自定义资源的密文内容相同。如果加密配置不匹配,还原将会失败。
|
||||
|
||||
`加密配置密文` 下拉菜单将过滤并仅列出拥有这个 key 的密文。
|
||||
`Encryption Config Secret` 下拉菜单将过滤并仅列出拥有这个 key 的密文。
|
||||
|
||||
| YAML 指令名称 | 描述 |
|
||||
| ---------------- | ---------------- |
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ weight: 3
|
||||
|
||||
关于创建存储类的信息,请参见[本章节](../../how-to-guides/advanced-user-guides/manage-clusters/create-kubernetes-persistent-storage/manage-persistent-storage/dynamically-provision-new-storage.md)。
|
||||
|
||||
::: note 重要提示:
|
||||
:::note 重要提示:
|
||||
|
||||
强烈建议使用回收策略为 "Retain" 的 StorageClass。否则,如果 `rancher-backup` Chart 创建的 PVC 在应用升级期间或意外被删除后,PV 也会被删除,也就是说所有保存在其中的备份都会被删除。
|
||||
如果没有这样的 StorageClass,则在设置 PV 之后,一定要将它的回收策略设置为 "Retain",然后再将备份存储在其中。
|
||||
|
||||
+3
-3
@@ -8,11 +8,11 @@ Rancher CLI(命令行界面)是一个命令行工具,可用于与 Rancher
|
||||
|
||||
### 下载 Rancher CLI
|
||||
|
||||
你可以直接 UI 下载二进制文件。链接位于 UI 页脚的右侧。我们提供用于 Windows、Mac 和 Linux 的二进制文件。你还可以访问我们的 CLI [发布页面](https://github.com/ranchcli/releases)直接下载二进制文件。
|
||||
你可以直接 UI 下载二进制文件。链接位于 UI 页脚的右侧。我们提供用于 Windows、Mac 和 Linux 的二进制文件。你还可以访问我们的 CLI [发布页面](https://github.com/rancher/cli/releases)直接下载二进制文件。
|
||||
|
||||
1. 点击左上角的 **☰**。
|
||||
1. 单击底部的 **v2.6.x**,**v2.6.x** 是一个超链接文本,表示已安装的 Rancher 版本。
|
||||
1. 在 **CLI 下载**中,有 Windows、Mac 和 Linux 的二进制文件下载链接。你还可以访问我们的 CLI [发布页面](https://github.com/ranchcli/releases)直接下载二进制文件。
|
||||
1. 在 **CLI 下载**中,有 Windows、Mac 和 Linux 的二进制文件下载链接。你还可以访问我们的 CLI [发布页面](https://github.com/rancher/cli/releases)直接下载二进制文件。
|
||||
|
||||
### 要求
|
||||
|
||||
@@ -85,4 +85,4 @@ INFO[0005] Saving config to /Users/markbishop/.ranchcli2.json
|
||||
|
||||
### 限制
|
||||
|
||||
Rancher CLI **不能**用于安装[仪表板应用程序或 Rancher 功能 Chart](../../pages-for-subheaders/helm-charts-in-rancher.md)。
|
||||
Rancher CLI **不能**用于安装[仪表板应用程序或 Rancher 功能 Chart](../../pages-for-subheaders/helm-charts-in-rancher.md)。
|
||||
|
||||
+2
-2
@@ -88,9 +88,9 @@ AKS 节点的默认用户名是 `azureuser`。
|
||||
|
||||
用于创建到 Linux 节点的 SSH 连接的密钥。
|
||||
|
||||
### 标签
|
||||
### Tags
|
||||
|
||||
如果你的组织使用标签来管理多个 Azure 服务的资源,那么集群标签则非常有用。这些标签不适用于集群内的资源。
|
||||
如果你的组织使用标签(Tag)来管理多个 Azure 服务的资源,那么集群标签则非常有用。这些标签不适用于集群内的资源。
|
||||
|
||||
## 网络选项
|
||||
|
||||
|
||||
+2
-2
@@ -133,8 +133,8 @@ Spot 实例现在[受 EKS 支持](https://docs.aws.amazon.com/eks/latest/usergui
|
||||
| 期望 ASG 大小 | 期望的实例数量。 |
|
||||
| 最大 ASG 大小 | 最大的实例数量。在安装 [Cluster Autoscaler](https://docs.aws.amazon.com/eks/latest/userguide/cluster-autoscaler.html) 之前,此设置不会生效。 |
|
||||
| 最小 ASG 大小 | 最小的实例数量。在安装 [Cluster Autoscaler](https://docs.aws.amazon.com/eks/latest/userguide/cluster-autoscaler.html) 之前,此设置不会生效。 |
|
||||
| 标签 | 应用于管理的节点组中节点的 Kubernetes 标签。 |
|
||||
| 标签 | 管理的节点组的标签,这些标签不会传播到任何相关资源。 |
|
||||
| Labels | 应用于管理的节点组中节点的 Kubernetes 标签。 |
|
||||
| Tags | 管理的节点组的标签,这些标签不会传播到任何相关资源。 |
|
||||
|
||||
|
||||
### 配置刷新间隔
|
||||
|
||||
+1
-1
@@ -223,7 +223,7 @@ stages:
|
||||
|
||||
| 字段 | 描述 |
|
||||
---------|----------|
|
||||
| 目录 | 将使用应用模板的商店应用。 |
|
||||
| Catalog | 将使用应用模板的商店应用。 |
|
||||
| 模板名称 | 应用模板的名称。例如,wordpress。 |
|
||||
| 模板版本 | 要部署的应用模板的版本。 |
|
||||
| 命名空间 | 要部署应用的目标命名空间。 |
|
||||
|
||||
+4
-1
@@ -25,7 +25,8 @@ weight: 3
|
||||
|
||||
底层 Kubernetes 集群的一种选择是使用 K3s Kubernetes。K3s 是 Rancher CNCF 认证的 Kubernetes 发行版。K3s 易于安装,仅需要 Kubernetes 内存的一半,所有组件都在一个小于 100 MB 的二进制文件中。K3s 的另一个优点是允许外部 Datastore 保存集群数据,因此可以把 K3s 服务器节点视为无状态。
|
||||
|
||||
<figcaption>运行 Rancher Management Server 的 K3s Kubernetes 集群架构</figcaption>
|
||||
<figcaption>运行 Rancher Management Server 的 K3s Kubernetes 集群的架构</figcaption>
|
||||
|
||||

|
||||
|
||||
### RKE Kubernetes 集群安装
|
||||
@@ -33,6 +34,7 @@ weight: 3
|
||||
在 RKE 安装中,集群数据在集群中的三个 etcd 节点上复制,以在某个节点发生故障时提供冗余和进行数据复制。
|
||||
|
||||
<figcaption>运行 Rancher Management Server 的 RKE Kubernetes 集群的架构</figcaption>
|
||||
|
||||

|
||||
|
||||
# Kubernetes 安装的负载均衡器推荐配置
|
||||
@@ -45,6 +47,7 @@ weight: 3
|
||||
* Ingress Controller 会把流量转发到 Rancher deployment 的 Pod 上的 TCP/80 端口。
|
||||
|
||||
<figcaption>在 Kubernetes 集群中安装 Rancher,并使用四层负载均衡器,SSL 终止在 Ingress Controller 中</figcaption>
|
||||
|
||||

|
||||
|
||||
# Kubernetes 安装环境
|
||||
|
||||
+3
-3
@@ -25,11 +25,11 @@ weight: 7010
|
||||
1. 单击 **RKE1 配置 > 节点模板**。
|
||||
1. 选择要编辑的节点模板并单击 **⋮ > 编辑**。
|
||||
|
||||
:::note
|
||||
:::note
|
||||
|
||||
默认的 `active` [主机驱动](../../how-to-guides/advanced-user-guides/authentication-permissions-and-global-configuration/about-provisioning-drivers/manage-node-drivers.md) 和任何标记了 `password` 字段的主机驱动都需要使用[云凭证](../../pages-for-subheaders/use-new-nodes-in-an-infra-provider.md#云凭证)。
|
||||
默认的 `active` [主机驱动](../../how-to-guides/advanced-user-guides/authentication-permissions-and-global-configuration/about-provisioning-drivers/manage-node-drivers.md)和任何标记了 `password` 字段的主机驱动都需要使用[云凭证](../../pages-for-subheaders/use-new-nodes-in-an-infra-provider.md#云凭证)。
|
||||
|
||||
:::
|
||||
:::
|
||||
|
||||
1. 编辑所需信息并单击**保存**。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user