Skip to content

Latest commit

 

History

History
30 lines (30 loc) · 1.47 KB

haproxy_keepalived.md

File metadata and controls

30 lines (30 loc) · 1.47 KB

使用haproxy负载减轻单个kube-apiserver压力,并使用keepalived保证高可用

在每个master节点上部署haproxy + keepalived服务。

  • keepalived 部分功能需要内核支持:
modprobe ip_vs
modprobe ip_vs_rr
modprobe ip_vs_wrr
lsmod | grep ip_vs
sysctl -w net.ipv4.ip_forward=1
sysctl -w net.ipv4.ip_nonlocal_bind=1
image:[自己镜像名字,haproxy 和 keepalived都需要修改]
volumes:
- hostPath:
    path: /etc/haproxy/haproxy.cfg [haproxy 配置文件位置]
  name: haproxy-cfg
  - hostPath:
    path: /etc/keepalived [keepalived 配置文件位置]
  name: keepalived-cfg
  - hostPath:
    path: /etc/keepalived/entrypoint.sh [entrypoint.sh 文件位置]
  name: entrypoint
  • haproxy.cfg文件中后端实例信息需要修改。示例文件中对kube-apiserver和etcd都做了负载均衡。
  • haproxykeepalived 镜像制作请参考其Dockerfile,基础镜像根据后缀可在hub上找到。
  • 修改好之后将yaml文件拷贝到kubelet配置--config=/data/kubernetes/manifests所在目录下