weixin_39861955
weixin_39861955
2021-01-06 06:15

contrib/keepalived-vip can't create multiple VIPs

Hi,

im trying to setup multiple VIPs inside of one Kubernetes cluster. One VIP is running smooth, but keepalived-vip doesn't setup another VIP:

vip-configmap.yaml


apiVersion: v1
kind: ConfigMap
metadata:
  name: vip-configmap
data:
  192.168.10.100: default/rc-ngx
  192.168.10.110: default/rc-ngx-dev

kubectl exec kube-keepalived-vip-8lkjf cat /etc/keepalived/keepalived.conf


global_defs {
  vrrp_version 3
  vrrp_iptables KUBE-KEEPALIVED-VIP
}

vrrp_instance vips {
  state BACKUP
  interface eth0
  virtual_router_id 50
  priority 102
  nopreempt
  advert_int 1

  track_interface {
    eth0
  }

  virtual_ipaddress { 
    192.168.10.100
  }
}

# Service: default/rc-ngx
virtual_server 192.168.10.100 443 {
  delay_loop 5
  lvs_sched wlc
  lvs_method NAT
  persistence_timeout 1800
  protocol TCP


  real_server 10.36.0.1 443 {
    weight 1
    TCP_CHECK {
      connect_port 443
      connect_timeout 3
    }
  }

  real_server 10.44.0.9 443 {
    weight 1
    TCP_CHECK {
      connect_port 443
      connect_timeout 3
    }
  }

  real_server 10.47.0.1 443 {
    weight 1
    TCP_CHECK {
      connect_port 443
      connect_timeout 3
    }
  }

} 

I expected keepalived-vip to read the second configuration from my configmap, raise an additional IP address and map the traffic to my second service.

Thanks Greets Kilian

该提问来源于开源项目:kubernetes-retired/contrib

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

12条回答

  • weixin_39611340 weixin_39611340 4月前

    I will add the custom virtual_router_id configuration in the next version to allow running multiple instances without collisions

    点赞 评论 复制链接分享
  • weixin_39611340 weixin_39611340 4月前

    Maybe someone can confirm that multiple services are not supported

    Yes it's supported. I'm running 1 keepalived-vip (daemonset) with 18 IPs (i.e. different services)

    点赞 评论 复制链接分享
  • weixin_39861955 weixin_39861955 4月前

    sounds really cool, i'll test aledbf/kube-keepalived-vip:0.13 or the next release and give you feedback if it worked for me

    点赞 评论 复制链接分享
  • weixin_39637457 weixin_39637457 4月前

    Yes it's supported. I'm running 1 keepalived-vip (daemonset) with 18 IPs (i.e. different services)

    Sound perfect for me. Maybe you can add a example configmap file where different services are specifed.

    点赞 评论 复制链接分享
  • weixin_39637457 weixin_39637457 4月前

    I have tested aledbf/kube-keepalived-vip:0.13 and have it running for a month or so. Works good with several IPs. The config file contains a row for each service like in the vip-configmap.yaml example file in this issue's first post.

    点赞 评论 复制链接分享
  • weixin_39861955 weixin_39861955 4月前

    can you say when your changes will get merged to the contrib/keepalived-vip repo?

    点赞 评论 复制链接分享
  • weixin_39738251 weixin_39738251 4月前

    Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

    Prevent issues from auto-closing with an /lifecycle frozen comment.

    If this issue is safe to close now please do so with /close.

    Send feedback to sig-testing, kubernetes/test-infra and/or ``. /lifecycle stale

    点赞 评论 复制链接分享
  • weixin_39738251 weixin_39738251 4月前

    Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

    If this issue is safe to close now please do so with /close.

    Send feedback to sig-testing, kubernetes/test-infra and/or ``. /lifecycle rotten /remove-lifecycle stale

    点赞 评论 复制链接分享
  • weixin_39738251 weixin_39738251 4月前

    Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

    Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /close

    点赞 评论 复制链接分享
  • weixin_39637457 weixin_39637457 4月前

    I have tried the same configuration, but it seems like it's not supported. I also tried running two deamon sets with two different keepalived-vip, but then I get a conflict due to they use the same virtual_router_id=50.

    Maybe someone can confirm that multiple services are not supported. If so, it might be interesting to create a PR that supports multiple services in the same configmap or setting the virtual_router_id or maybe both solutions.

    点赞 评论 复制链接分享
  • weixin_39861955 weixin_39861955 4月前

    I got it running by compiling / building a new docker-image with another keepalived.tmpl:

    virtual_router_id 51

    Then you can run two VIPs inside one cluster. But thats not the preferred way ... would be much better if you can setup "virtual_router_id" via configmap as said.

    点赞 评论 复制链接分享
  • weixin_39611340 weixin_39611340 4月前

    please test aledbf/kube-keepalived-vip:0.13 (PR #2041)

    点赞 评论 复制链接分享

相关推荐