Closed panpan0000 closed 5 years ago
Closing. No, the definition in the configmap is about ports, no targetPorts. We lookup targetPorts in the getEndpoints
function
oh, sorry for that. My bad
Hmm... @aledbf , sorry I think I should point to this one:
svcs = append(svcs, vip{
Name: ...
IP: ...
Port: int(servicePort.Port), // --> here, should it be servicePort.TargetPort ?
LVSMethod: ...,
Backends: ..,
Protocol: ...,
})
https://github.com/aledbf/kube-keepalived-vip/blob/master/pkg/controller/main.go#L238
in
pkg/controller/main.go
func:getServices
since the
real_server
in/etc/keepalived/keepalived.conf
is POD IP, instead of cluster IP, so we should useSpec.TargetPorts
instead ofSpec.Ports
? sinceTargetPort
is the container's port, andPort
is the cluster IP port.(https://kubernetes.io/docs/concepts/services-networking/service/)