kube-vip

kube-vip provides an easy means of configuration a virtual IP to follow the current Kubernetes control plane leader.

Configuration

Create /etc/kubernetes/kube-vip/config.yaml:

localPeer:
    id: master0
    address: 10.0.0.6
    port: 10000
remotePeers:
  - id: master1
      address: 10.0.0.7
      port: 10000
  - id: master2
      address: 10.0.0.8
      port: 10000
vip: 10.0.0.5
gratuitousARP: true
singleNode: false
startAsLeader: true
interface: eth0
loadBalancers:
  - name: API Server Load Balancer
      type: tcp
      port: 6443
      bindToVip: false
      backends:
        - port: 6443
            address: master0
        - port: 6443
            address: master1
        - port: 6443
            address: master2

Installation

Create a static pod manifest at /etc/kubernetes/manifests/kube-vip.yaml to ensure the Kubelet on the node launches the process.

apiVersion: v1
kind: Pod
metadata:
    creationTimestamp: null
    name: kube-vip
    namespace: kube-system
spec:
    containers:
      - command:
            - /kube-vip
            - start
            - -c
            - /vip.yaml
          image: "plndr/kube-vip:0.1.1"
          name: kube-vip
          resources: {}
          securityContext:
              capabilities:
                  add:
                    - NET_ADMIN
                    - SYS_TIME
          volumeMounts:
            - mountPath: /vip.yaml
                name: config
    hostNetwork: true
    volumes:
      - hostPath:
              path: /etc/kubernetes/kube-vip/config.yaml
          name: config
status: {}

Now restart the Kubelet.


Backlinks