Files
k8s-note/k8s知识笔记/三、service/6、IPVS 持久化连接.conf
2025-10-16 23:18:49 +08:00

13 lines
990 B
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

一、会话保持
IPVS支持会话保持功能, 可以通过以下方式实现:
1. 使用--persistent参数, 该参数指定会话保持的时间, 单位为秒. 例如, --persistent=300表示会话保持300秒.
2. 使用--hash参数, 该参数指定用于会话保持的哈希算法. 常用的哈希算法包括:
- sourceip: 基于源IP地址进行哈希计算, 适用于客户端IP地址不变的场景.
- sourceipport: 基于源IP地址和源端口进行哈希计算, 适用于客户端IP地址可能变化但端口不变的场景.
- destinationip: 基于目标IP地址进行哈希计算, 适用于服务端IP地址不变的场景.
- destinationipport: 基于目标IP地址和目标端口进行哈希计算, 适用于服务端IP地址可能变化但端口不变的场景.
# 资源清单内开启基于客户端的会话保持默认3个小时超时3个小时内有连接会重置3小时超时
service.spec.sessionAffinity:ClientIP