mirror of
https://github.com/kubesphere/website.git
synced 2025-12-26 00:12:48 +00:00
change directory and translate
Signed-off-by: zhuxiujuan28 <562873187@qq.com>
This commit is contained in:
parent
55b68bd002
commit
3cf5ea3313
|
|
@ -21,15 +21,14 @@ This section explains the following methods for configuring high availability:
|
|||
To use HAProxy for high availability, you need to configure the following parameters in the installation configuration file **config-sample.yaml** during the installation of {ks_product-en}:
|
||||
|
||||
// YAML
|
||||
include::../../../../_ks_components-en/code/yaml.adoc[]
|
||||
|
||||
[source,yaml]
|
||||
----
|
||||
spec:
|
||||
controlPlaneEndpoint:
|
||||
internalLoadbalancer: haproxy
|
||||
domain: lb.kubesphere.local
|
||||
address: ""
|
||||
port: 6443
|
||||
|
||||
----
|
||||
|
||||
KubeKey will automatically install HAProxy on the worker nodes and complete the high availability configuration, requiring no additional actions. For more information, please refer to link:../../../02-install-kubesphere/02-install-kubernetes-and-kubesphere/[Install Kubernetes and {ks_product-en}].
|
||||
|
|
@ -62,9 +61,7 @@ The following describes how to configure a generic server as a load balancer usi
|
|||
// Bash
|
||||
[,bash]
|
||||
----
|
||||
|
||||
apt install keepalived haproxy psmisc -y
|
||||
|
||||
----
|
||||
--
|
||||
|
||||
|
|
@ -74,9 +71,7 @@ apt install keepalived haproxy psmisc -y
|
|||
// Bash
|
||||
[,bash]
|
||||
----
|
||||
|
||||
vi /etc/haproxy/haproxy.cfg
|
||||
|
||||
----
|
||||
--
|
||||
|
||||
|
|
@ -86,7 +81,6 @@ vi /etc/haproxy/haproxy.cfg
|
|||
// Bash
|
||||
[,bash]
|
||||
----
|
||||
|
||||
global
|
||||
log /dev/log local0 warning
|
||||
chroot /var/lib/haproxy
|
||||
|
|
@ -121,7 +115,6 @@ backend kube-apiserver
|
|||
server kube-apiserver-1 <IP address>:6443 check
|
||||
server kube-apiserver-2 <IP address>:6443 check
|
||||
server kube-apiserver-3 <IP address>:6443 check
|
||||
|
||||
----
|
||||
--
|
||||
|
||||
|
|
@ -131,9 +124,7 @@ backend kube-apiserver
|
|||
// Bash
|
||||
[,bash]
|
||||
----
|
||||
|
||||
systemctl restart haproxy
|
||||
|
||||
----
|
||||
--
|
||||
|
||||
|
|
@ -143,9 +134,7 @@ systemctl restart haproxy
|
|||
// Bash
|
||||
[,bash]
|
||||
----
|
||||
|
||||
systemctl enable haproxy
|
||||
|
||||
----
|
||||
--
|
||||
|
||||
|
|
@ -155,9 +144,7 @@ systemctl enable haproxy
|
|||
// Bash
|
||||
[,bash]
|
||||
----
|
||||
|
||||
vi /etc/keepalived/keepalived.conf
|
||||
|
||||
----
|
||||
--
|
||||
|
||||
|
|
@ -167,7 +154,6 @@ vi /etc/keepalived/keepalived.conf
|
|||
// Bash
|
||||
[,bash]
|
||||
----
|
||||
|
||||
global_defs {
|
||||
notification_email {
|
||||
}
|
||||
|
|
@ -206,7 +192,6 @@ vrrp_instance haproxy-vip {
|
|||
chk_haproxy
|
||||
}
|
||||
}
|
||||
|
||||
----
|
||||
|
||||
Replace the following parameters with actual values:
|
||||
|
|
@ -235,9 +220,7 @@ Replace the following parameters with actual values:
|
|||
// Bash
|
||||
[,bash]
|
||||
----
|
||||
|
||||
systemctl restart keepalived
|
||||
|
||||
----
|
||||
--
|
||||
|
||||
|
|
@ -247,9 +230,7 @@ systemctl restart keepalived
|
|||
// Bash
|
||||
[,bash]
|
||||
----
|
||||
|
||||
systemctl enable keepalived
|
||||
|
||||
----
|
||||
--
|
||||
|
||||
|
|
@ -266,9 +247,7 @@ systemctl enable keepalived
|
|||
// Bash
|
||||
[,bash]
|
||||
----
|
||||
|
||||
ip a s
|
||||
|
||||
----
|
||||
|
||||
If the system's high availability is functioning properly, the configured floating IP address will be displayed in the command output. For example, in the following command output, **inet 172.16.0.10/24 scope global secondary eth0** indicates that the floating IP address is bound to the eth0 network interface:
|
||||
|
|
@ -276,7 +255,6 @@ If the system's high availability is functioning properly, the configured floati
|
|||
// Bash
|
||||
[,bash]
|
||||
----
|
||||
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
|
||||
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
|
||||
inet 127.0.0.1/8 scope host lo
|
||||
|
|
@ -300,9 +278,7 @@ If the system's high availability is functioning properly, the configured floati
|
|||
// Bash
|
||||
[,bash]
|
||||
----
|
||||
|
||||
systemctl stop haproxy
|
||||
|
||||
----
|
||||
--
|
||||
|
||||
|
|
@ -312,9 +288,7 @@ systemctl stop haproxy
|
|||
// Bash
|
||||
[,bash]
|
||||
----
|
||||
|
||||
ip a s
|
||||
|
||||
----
|
||||
|
||||
If the system's high availability is functioning properly, the command output will no longer display the floating IP address, as shown in the following command output:
|
||||
|
|
@ -322,7 +296,6 @@ If the system's high availability is functioning properly, the command output wi
|
|||
// Bash
|
||||
[,bash]
|
||||
----
|
||||
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
|
||||
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
|
||||
inet 127.0.0.1/8 scope host lo
|
||||
|
|
@ -335,7 +308,6 @@ If the system's high availability is functioning properly, the command output wi
|
|||
valid_lft 72802sec preferred_lft 72802sec
|
||||
inet6 fe80::510e:f96:98b2:af40/64 scope link noprefixroute
|
||||
valid_lft forever preferred_lft forever
|
||||
|
||||
----
|
||||
--
|
||||
|
||||
|
|
@ -345,9 +317,7 @@ If the system's high availability is functioning properly, the command output wi
|
|||
// Bash
|
||||
[,bash]
|
||||
----
|
||||
|
||||
ip a s
|
||||
|
||||
----
|
||||
|
||||
If the system's high availability is functioning properly, the configured floating IP address will be displayed in the command output. For example, in the following command output, **inet 172.16.0.10/24 scope global secondary eth0** indicates that the floating IP address is bound to the eth0 network interface:
|
||||
|
|
@ -355,7 +325,6 @@ If the system's high availability is functioning properly, the configured floati
|
|||
// Bash
|
||||
[,bash]
|
||||
----
|
||||
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
|
||||
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
|
||||
inet 127.0.0.1/8 scope host lo
|
||||
|
|
@ -370,7 +339,6 @@ If the system's high availability is functioning properly, the configured floati
|
|||
valid_lft forever preferred_lft forever
|
||||
inet6 fe80::f67c:bd4f:d6d5:1d9b/64 scope link noprefixroute
|
||||
valid_lft forever preferred_lft forever
|
||||
|
||||
----
|
||||
--
|
||||
|
||||
|
|
@ -380,8 +348,6 @@ If the system's high availability is functioning properly, the configured floati
|
|||
// Bash
|
||||
[,bash]
|
||||
----
|
||||
|
||||
systemctl start haproxy
|
||||
|
||||
----
|
||||
--
|
||||
|
|
|
|||
|
|
@ -0,0 +1,221 @@
|
|||
---
|
||||
title: "Configure KubeSphere High Availability"
|
||||
keywords: "Kubernetes, {ks_product-en}, Installation, Preparation, High Availability"
|
||||
description: "Learn how to configure high availability for KubeSphere."
|
||||
weight: 04
|
||||
---
|
||||
|
||||
This section describes how to configure high availability (HA) for KubeSphere.
|
||||
|
||||
[.admon.attention,cols="a"]
|
||||
|===
|
||||
|Attention
|
||||
|
||||
|KubeSphere high availability depends on Kubernetes high availability of control plane nodes. Ensure Kubernetes is deployed in high availability mode first.
|
||||
|
||||
|===
|
||||
|
||||
== 1. High Availability Architecture Overview
|
||||
|
||||
KubeSphere supports high availability deployment through `ha.enabled` configuration.
|
||||
|
||||
In HA mode, Redis supports two deployment modes:
|
||||
|
||||
. Redis standalone mode
|
||||
. Redis high availability mode (Redis HA)
|
||||
|
||||
== 2. Version Compatibility
|
||||
|
||||
KubeSphere HA configuration applies to {ks_product-en} v4.1.2 and later versions.
|
||||
|
||||
== 3. KubeSphere HA Configuration
|
||||
|
||||
=== 3.1 Enabling HA Mode
|
||||
|
||||
Create a `values.yaml` file with the following configuration:
|
||||
|
||||
[source,yaml]
|
||||
----
|
||||
ha:
|
||||
enabled: true
|
||||
----
|
||||
|
||||
== 4. Redis Configuration
|
||||
|
||||
Choose either Redis standalone mode or Redis HA mode and add corresponding configurations to `values.yaml`.
|
||||
|
||||
=== 4.1 Redis Standalone Mode
|
||||
|
||||
Suitable for small clusters with simple configuration and lower resource consumption.
|
||||
|
||||
[source,yaml]
|
||||
----
|
||||
redis:
|
||||
port: 6379
|
||||
replicaCount: 1
|
||||
image:
|
||||
repository: kubesphereio/redis
|
||||
tag: 7.2.4-alpine
|
||||
pullPolicy: IfNotPresent
|
||||
persistentVolume:
|
||||
enabled: true
|
||||
size: 2Gi
|
||||
----
|
||||
|
||||
=== 4.2 Redis HA Mode
|
||||
|
||||
Recommended for production environments, providing full high availability.
|
||||
|
||||
[source,yaml]
|
||||
----
|
||||
redisHA:
|
||||
enabled: true
|
||||
redis:
|
||||
port: 6379
|
||||
image:
|
||||
repository: kubesphereio/redis
|
||||
tag: 7.2.4-alpine
|
||||
pullPolicy: IfNotPresent
|
||||
persistentVolume:
|
||||
enabled: true
|
||||
size: 2Gi
|
||||
----
|
||||
|
||||
=== 4.3 Redis HA Advanced Configuration
|
||||
|
||||
[source,yaml]
|
||||
----
|
||||
redisHA:
|
||||
enabled: true
|
||||
# Redis node configuration
|
||||
redis:
|
||||
port: 6379
|
||||
# Persistence configuration
|
||||
persistentVolume:
|
||||
enabled: true
|
||||
size: 2Gi
|
||||
# Node affinity
|
||||
tolerations:
|
||||
- key: node-role.kubernetes.io/master
|
||||
effect: NoSchedule
|
||||
- key: node-role.kubernetes.io/control-plane
|
||||
effect: NoSchedule
|
||||
- key: CriticalAddonsOnly
|
||||
operator: Exists
|
||||
# HA configuration
|
||||
hardAntiAffinity: false
|
||||
additionalAffinities:
|
||||
nodeAffinity:
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
- weight: 100
|
||||
preference:
|
||||
matchExpressions:
|
||||
- key: node-role.kubernetes.io/control-plane
|
||||
operator: In
|
||||
values:
|
||||
- ""
|
||||
# HAProxy configuration
|
||||
haproxy:
|
||||
servicePort: 6379
|
||||
containerPort: 6379
|
||||
image:
|
||||
repository: kubesphereio/haproxy
|
||||
tag: 2.9.6-alpine
|
||||
pullPolicy: IfNotPresent
|
||||
----
|
||||
|
||||
== 5. HA Deployment
|
||||
|
||||
Add `-f values.yaml` when installing or upgrading {ks_product-en}.
|
||||
|
||||
[.admon.attention,cols="a"]
|
||||
|===
|
||||
|Attention
|
||||
|
||||
|The following commands are examples. Always append `-f values.yaml` to your actual installation/upgrade commands.
|
||||
|
||||
|===
|
||||
|
||||
// KubeSphere
|
||||
[source,bash]
|
||||
----
|
||||
# Installation
|
||||
helm upgrade --install -n kubesphere-system --create-namespace ks-core https://charts.kubesphere.io/main/ks-core-1.1.4.tgz -f values.yaml --debug --wait
|
||||
|
||||
# Upgrade
|
||||
helm upgrade -n kubesphere-system ks-core https://charts.kubesphere.io/main/ks-core-1.1.4.tgz -f values.yaml --debug --wait
|
||||
----
|
||||
|
||||
// kse
|
||||
// [source,bash]
|
||||
// ----
|
||||
// # Installation
|
||||
// helm install -n kubesphere-system --create-namespace ks-core oci://hub.kubesphere.com.cn/kse/ks-core --version 1.1.0 -f values.yaml
|
||||
|
||||
// # Upgrade
|
||||
// helm upgrade -n kubesphere-system ks-core oci://hub.kubesphere.com.cn/kse/ks-core --version 1.1.0 -f values.yaml
|
||||
// ----
|
||||
|
||||
|
||||
== 6. Configuration Reference
|
||||
|
||||
=== 6.1 Redis Standalone Mode
|
||||
|
||||
- Suitable for small clusters
|
||||
- Uses single Redis instance
|
||||
- Supports basic failover
|
||||
- Simple configuration with low resource consumption
|
||||
|
||||
=== 6.2 Redis HA Mode
|
||||
|
||||
- Recommended for production
|
||||
- Uses Redis cluster
|
||||
- Provides full high availability
|
||||
- Supports automatic failover
|
||||
- Data persistence
|
||||
- Load balancing
|
||||
|
||||
== 7. Optional Configurations
|
||||
|
||||
=== JWT Signing Key Configuration
|
||||
|
||||
In high availability environments, configure a custom SignKey to ensure all replicas use the same JWT signing key.
|
||||
|
||||
. Generate an RSA private key.
|
||||
+
|
||||
[source,bash]
|
||||
----
|
||||
openssl genrsa -out private_key.pem 2048
|
||||
----
|
||||
|
||||
. View the Base64-encoded key.
|
||||
+
|
||||
[source,bash]
|
||||
----
|
||||
cat private_key.pem | base64 -w 0
|
||||
----
|
||||
|
||||
. Edit KubeSphere configuration.
|
||||
+
|
||||
--
|
||||
[source,bash]
|
||||
----
|
||||
kubectl -n kubesphere-system edit cm kubesphere-config
|
||||
----
|
||||
|
||||
Add or replace the following field under `authentication.issuer`:
|
||||
|
||||
[source,yaml]
|
||||
----
|
||||
signKeyData: <Base64-encoded private key>
|
||||
----
|
||||
--
|
||||
|
||||
. Restart KubeSphere components.
|
||||
+
|
||||
[source,bash]
|
||||
----
|
||||
kubectl -n kubesphere-system rollout restart deploy ks-apiserver ks-controller-manager
|
||||
----
|
||||
|
||||
. Verify configuration. Access `http://<ks-console-address>/oauth/keys` multiple times in browser to check if responses from all replicas are consistent.
|
||||
|
|
@ -18,7 +18,7 @@ sectionLink:
|
|||
- /docs/v4.1/02-quickstart/01-install-kubesphere.adoc
|
||||
- /docs/v4.1/03-installation-and-upgrade/02-install-kubesphere/02-install-kubernetes-and-kubesphere.adoc
|
||||
- /docs/v4.1/02-quickstart/04-control-user-permissions.adoc
|
||||
- docs/v4.1/03-installation-and-upgrade/02-install-kubesphere/04-offline-installation.adoc
|
||||
- docs/v4.1/03-installation-and-upgrade/02-install-kubesphere/03-offline-installation.adoc
|
||||
- /docs/v4.1/03-installation-and-upgrade/05-add-and-delete-cluster-nodes/01-add-cluster-nodes.adoc
|
||||
- /docs/v4.1/07-cluster-management/10-multi-cluster-management
|
||||
- /docs/v4.1/02-quickstart/03-install-an-extension.adoc
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ title: "离线安装 KubeSphere"
|
|||
linkTitle: "离线安装 KubeSphere"
|
||||
keywords: "Kubernetes, KubeSphere, 安装, 离线包, 离线安装, 离线部署"
|
||||
description: "了解如何在离线环境下安装 KubeSphere 和 Kubernetes。"
|
||||
weight: 04
|
||||
weight: 03
|
||||
---
|
||||
|
||||
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
title: "配置 KubeSphere 高可用性"
|
||||
keywords: "Kubernetes, {ks_product}, 安装, 准备, 高可用"
|
||||
description: "介绍如何为 KubeSphere 配置高可用性。"
|
||||
weight: 03
|
||||
weight: 04
|
||||
---
|
||||
|
||||
|
||||
|
|
@ -161,12 +161,14 @@ helm upgrade -n kubesphere-system ks-core https://charts.kubesphere.io/main/ks-c
|
|||
== 6. 配置说明
|
||||
|
||||
=== 6.1 Redis 单实例模式
|
||||
|
||||
- 适用于小型集群
|
||||
- 使用单实例 Redis
|
||||
- 支持基本的故障转移
|
||||
- 配置简单,资源消耗较少
|
||||
|
||||
=== 6.2 Redis 高可用模式
|
||||
|
||||
- 适用于生产环境
|
||||
- 使用 Redis 集群
|
||||
- 提供完整的高可用性
|
||||
|
|
@ -18,7 +18,7 @@ sectionLink:
|
|||
- /docs/v4.1/02-quickstart/01-install-kubesphere.adoc
|
||||
- /docs/v4.1/03-installation-and-upgrade/02-install-kubesphere/02-install-kubernetes-and-kubesphere.adoc
|
||||
- /docs/v4.1/02-quickstart/04-control-user-permissions.adoc
|
||||
- docs/v4.1/03-installation-and-upgrade/02-install-kubesphere/04-offline-installation.adoc
|
||||
- docs/v4.1/03-installation-and-upgrade/02-install-kubesphere/03-offline-installation.adoc
|
||||
- /docs/v4.1/03-installation-and-upgrade/05-add-and-delete-cluster-nodes/01-add-cluster-nodes.adoc
|
||||
- /docs/v4.1/07-cluster-management/10-multi-cluster-management
|
||||
- /docs/v4.1/02-quickstart/03-install-an-extension.adoc
|
||||
|
|
|
|||
Loading…
Reference in New Issue