services-controller: Add LoadBalancer Service support (#53)

* Allow LoadBalancer Service type
* Update docs
This commit is contained in:
Bryan Zubrod 2017-07-11 18:12:11 -05:00 committed by GitHub
parent 537cacc5c8
commit a3bddf6ecd
4 changed files with 8 additions and 8 deletions

View File

@ -120,10 +120,10 @@ leverages standard Linux technologies **iptables, ipvs/lvs, ipset, iproute2**
[Kubernetes network services proxy with IPVS/LVS](https://cloudnativelabs.github.io/post/2017-05-10-kube-network-service-proxy/) [Kubernetes network services proxy with IPVS/LVS](https://cloudnativelabs.github.io/post/2017-05-10-kube-network-service-proxy/)
Kube-router uses IPVS/LVS technology built in Linux to provide L4 load Kube-router uses IPVS/LVS technology built in Linux to provide L4 load
balancing. Each **ClusterIP** and **NodePort** Kubernetes Service type is balancing. Each **ClusterIP**, **NodePort**, and **LoadBalancer** Kubernetes
configured as an IPVS virtual service. Each Service Endpoint is configured as Service type is configured as an IPVS virtual service. Each Service Endpoint is
real server to the virtual service. The standard **ipvsadm** tool can be used configured as real server to the virtual service. The standard **ipvsadm** tool
to verify the configuration and monitor the active connections. can be used to verify the configuration and monitor the active connections.
Below is example set of Services on Kubernetes: Below is example set of Services on Kubernetes:

View File

@ -118,7 +118,7 @@ func (nrc *NetworkRoutingController) Run(stopCh <-chan struct{}, wg *sync.WaitGr
if nrc.advertiseClusterIp { if nrc.advertiseClusterIp {
glog.Infof("Advertising cluster ips") glog.Infof("Advertising cluster ips")
for _, svc := range watchers.ServiceWatcher.List() { for _, svc := range watchers.ServiceWatcher.List() {
if svc.Spec.Type == "ClusterIP" || svc.Spec.Type == "NodePort" { if svc.Spec.Type == "ClusterIP" || svc.Spec.Type == "NodePort" || svc.Spec.Type == "LoadBalancer" {
// skip headless services // skip headless services
if svc.Spec.ClusterIP == "None" || svc.Spec.ClusterIP == "" { if svc.Spec.ClusterIP == "None" || svc.Spec.ClusterIP == "" {

View File

@ -34,7 +34,7 @@ var (
) )
// Network services controller enables local node as network service proxy through IPVS/LVS. // Network services controller enables local node as network service proxy through IPVS/LVS.
// Support only Kuberntes network services of type NodePort, ClusterIP. For each service a // Support only Kubernetes network services of type NodePort, ClusterIP, and LoadBalancer. For each service a
// IPVS service is created and for each service endpoint a server is added to the IPVS service. // IPVS service is created and for each service endpoint a server is added to the IPVS service.
// As services and endpoints are updated, network service controller gets the updates from // As services and endpoints are updated, network service controller gets the updates from
// the kubernetes api server and syncs the ipvs configuration to reflect state of services // the kubernetes api server and syncs the ipvs configuration to reflect state of services
@ -317,7 +317,7 @@ func buildServicesInfo() serviceInfoMap {
continue continue
} }
if svc.Spec.Type == "LoadBalancer" || svc.Spec.Type == "ExternalName" { if svc.Spec.Type == "ExternalName" {
glog.Infof("Skipping service name:%s namespace:%s due to service Type=%s", svc.Name, svc.Namespace, svc.Spec.Type) glog.Infof("Skipping service name:%s namespace:%s due to service Type=%s", svc.Name, svc.Namespace, svc.Spec.Type)
continue continue
} }

View File

@ -63,5 +63,5 @@ func (s *KubeRouterConfig) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&s.PeerAsn, "peer-asn", s.PeerAsn, "ASN number of the BGP peer to which cluster nodes will advertise cluster ip and node's pod cidr") fs.StringVar(&s.PeerAsn, "peer-asn", s.PeerAsn, "ASN number of the BGP peer to which cluster nodes will advertise cluster ip and node's pod cidr")
fs.BoolVar(&s.FullMeshMode, "nodes-full-mesh", s.FullMeshMode, "When enabled each node in the cluster will setup BGP peer with rest of the nodes. True by default") fs.BoolVar(&s.FullMeshMode, "nodes-full-mesh", s.FullMeshMode, "When enabled each node in the cluster will setup BGP peer with rest of the nodes. True by default")
fs.StringVar(&s.HostnameOverride, "hostname-override", s.HostnameOverride, "If non-empty, will use this string as identification instead of the actual hostname.") fs.StringVar(&s.HostnameOverride, "hostname-override", s.HostnameOverride, "If non-empty, will use this string as identification instead of the actual hostname.")
fs.BoolVar(&s.GlobalHairpinMode, "hairpin-mode", s.GlobalHairpinMode, "Adds iptable rules for every ClusterIP Service Endpoint to support hairpin traffic. False by default") fs.BoolVar(&s.GlobalHairpinMode, "hairpin-mode", s.GlobalHairpinMode, "Adds iptable rules for every Service Endpoint to support hairpin traffic. False by default")
} }